[Bash] Download an Imgur album
If I see one more rectangle this morning, I will scream. Instead I am writing a very simple Imgur gallery downloader for a friend, using extant Bash utilities.
#!/bin/bash wget $1 LIST=files.list mv $(ls -1 .) $LIST # Strip the file down to the actual image links. cat $LIST | grep href | grep jpg | grep -v rel > $LIST # Could be a one-liner, but I like neatness. cat $LIST | sed 's/<a href\="//g' | sed 's/">//g' > $LIST # Download the files. wget -i $LIST
In order:
- You invoke it with
fetch $URL. - The script uses grep to strip the file down to a raw list of relevant hyperlinks.
- sed strips the formatting.
- wget fetches the remaining files.
Categorised as: linux, programming