Skip to content

Instantly share code, notes, and snippets.

@sblask
Last active December 29, 2015 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sblask/7652174 to your computer and use it in GitHub Desktop.
Save sblask/7652174 to your computer and use it in GitHub Desktop.
Download all wallpapers from national geographic
#!/bin/bash
root=http://ngm.nationalgeographic.com
months=(january february march april may june july august september october november december)
download() {
year=$1
from=$2
to=$3
for month in $(seq $from $to)
do
folder=${year}-`printf %02d $month`
mkdir ${folder}
curl ${root}/wallpaper/${year}/${months[month - 1]}-ngm-wallpaper |
grep "Download wallpaper" |
awk 'BEGIN {FS="\""} {print $2}' |
while read url
do
wget ${root}${url} --directory-prefix ${folder}
done
done
}
download 2011 10 12
download 2012 1 12
download 2013 1 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment