Register
It is currently Sat Jul 26, 2014 5:11 am

Using bash to download comics


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Wed Dec 27, 2006 11:16 am   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 662
Location: Des Moines, Iowa
Using bash to download comics....

Code:
#!/bin/bash
mkdir penny;cd penny
for month in `seq -f "%02g" 1 12`;do
for day in `seq -f "%02g" 1 31`
do wget http://www.penny-arcade.com/images/2006/2006${month}${day}.jpg; done; done;
for i in *.jpg;do type=`eval file $i | awk '{ print $2, $3, $4 }'` ; correct_type="JPEG image data,"
if [ "$type" != "$correct_type" ];then rm -f $i;fi;done
exit 0


Top
 Profile WWW  
 PostPosted: Tue Jan 02, 2007 12:19 am   
User avatar

Joined: Mon Oct 16, 2006 10:41 pm
Posts: 2
not all of the images are jpg

alot are GIF and PNG.

Also there's not a comic every day... so just looping through all days for all months is kind of a sloppy technique.


Top
 Profile  
 PostPosted: Tue Jan 02, 2007 9:34 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 662
Location: Des Moines, Iowa
VHockey86 wrote:
not all of the images are jpg

alot are GIF and PNG.

Also there's not a comic every day... so just looping through all days for all months is kind of a sloppy technique.


Yeah.....but it worked ;) lol.


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP