Created
October 6, 2012 06:37
-
-
Save dtrailin/3844234 to your computer and use it in GitHub Desktop.
Imgur downloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ImgurDir { | |
| if [ -d ~/imgur\ albums ] | |
| then | |
| cd ~/imgur\ albums | |
| else | |
| mkdir ~/imgur\ albums | |
| cd ~/imgur\ albums | |
| fi | |
| } | |
| function readAlbum { | |
| echo "what album do you want?" | |
| read album | |
| } | |
| function GetLinks { | |
| wget -q www.imgur.com/a/$album | |
| links=$(grep -o \<img\ id=\"thumb-..... $album) | |
| rm $album | |
| } | |
| function subdir { | |
| if [ -d $album ] | |
| then | |
| cd $album | |
| rm -rf | |
| else | |
| mkdir $album | |
| cd $album | |
| fi | |
| } | |
| function GetImg { | |
| COUNTER=0 | |
| printf %s "$links" | while IFS= read -r line | |
| do | |
| let COUNTER=COUNTER+1 | |
| shorter=${line:15} | |
| wget -q www.i.imgur.com/$shorter.gif | |
| echo "getting image" $COUNTER | |
| done | |
| } | |
| function main { | |
| ImgurDir | |
| long=$USERNAME | |
| short=${long:0:1} | |
| echo "Welcome" "${short^^}""${long:1}" "to Denis' Imgur album downloading script!(currently only supports \"Blog Layout\")" | |
| readAlbum | |
| subdir | |
| GetLinks | |
| GetImg | |
| } | |
| main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment