If you want to accomplish similar things with bash, you can take advantage of jq which will allow you to template a string out from a set of object properties.
Here's a command split onto three lines. https://twitter.com/wesbos/status/1326345600141582336
Here's a command split onto three lines. https://twitter.com/wesbos/status/1326345600141582336
first `wget -O - url` will use wget to fetch the json from the API. wget by default writes it out to a file named shows (the last segment of the url) but we're going to pipe it to stdout so we can use it without an additional file, that's what `-O -` is doing.
if we look at the core of what jq is doing, we're iterating over the json results with .[], then producing a templated string for the file name and grabbing the url out. without -r and sh we end up with an array of the results.
once we add in the @\\sh formatter (other options are @\\tsv @\\csv, etc) to the jq query, we'll need -r, otherwise it will get wrapped in an additional string (without -r on left, with -r on right)
this gives us a list of `filename` and `url` separated by a space (because of the sh formatter), which we can pass directly into xargs. xargs will run a templated command for each line for us (wget -O $line) and we need to grab the filename and url, so we use -n2