Created
August 3, 2015 19:49
-
-
Save felipetavares/c9bda914456c423e9f65 to your computer and use it in GitHub Desktop.
Download all the User Friendly comics!
This file contains 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
#!/bin/bash | |
years="1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015" | |
months1="01 02 03 04 05 06 07 08 09 10 11 12" | |
months2="11 12" | |
n=1 | |
for y in $years | |
do | |
if [ $y = "1997" ]; then | |
months=$months2 | |
else | |
months=$months1 | |
fi | |
for m in $months | |
do | |
d=1 | |
while [ $d -lt 31 ]; | |
do | |
rd="" | |
if [ $d -lt 10 ]; then | |
rd="0$d" | |
else | |
rd="$d" | |
fi | |
echo -ne Searching number $n\\r | |
url="http://ars.userfriendly.org/cartoons/?id=${y}${m}${rd}" | |
wget $url -O tmp.html 2> /dev/null | |
image=`cat tmp.html | grep -o "http://www.userfriendly.org/cartoons/archives/.\+\.gif"` | |
if [ "$image" != "" ]; then | |
if [ ! -f "${n}.png" ]; then | |
echo -ne Downloading number $n\\r | |
wget $image -O "${n}.gif" 2> /dev/null | |
convert -verbose -coalesce "${n}.gif" "${n}.png" | |
if [ -f tmp.html ]; then | |
rm tmp.html | |
fi | |
rm *.gif | |
fi | |
let "n++" | |
fi | |
let "d++" | |
done | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you happen to still have the archive? They took down the site in February of this year.