How can I download png images from an xml feed that looks the following way?
<ListBucketResult xmlns="http://url1.com">
<Name>imagesToUse</Name>
<Prefix/>
<Marker/>
<IsTruncated>false</IsTruncated>
<Contents>
<ImageStuff>imagetodownload.png</ImageStuff>
<Size>17293</Size>
</Contents>
I was taking a look at this question on here about the same topic, except that I don't need to rename them, just download them.
Being new to shell scripts, I'm not quite sure how to do this (although I can definitely do this in 2 minutes in objective-c).
I have tried creating the following script and running bash myscript.sh
#!/bin/bash
URL='https://theurlwiththexml.com'
i=0
for u in $(curl -s "$URL" |
grep png |
sed -E 's/.*<ImageStuff>(.+)<\/ImageStuff>/\1/'); do
curl -s "$u" -o $i.png
(( i++ ))
done
But nothing happens. It just prints another line without errors.