Page 1 of 1

xkcd.com ripper

Posted: Sun Aug 25, 2013 6:59 am
by shaosean
I enjoy web comics and wanted to have the full archive of xkcd.com in my archive, so here is the script I used to grab the images.. Just thought I would share incase anyone else is interested in it as well..

Code: Select all

on mouseUp
   constant xkcd = "http://xkcd.com/"
   constant ImageUrlForHotLinking = "Image URL (for hotlinking/embedding): "
   
   local tData
   local tRemotePath
   local tLocalPath
   
   answer folder "Select a folder to save the images to:" as sheet
   if (it <> EMPTY) then
      put it into tLocalPath
      
      repeat with i = 1 to 1255
         put URL (xkcd & i & SLASH) into tData
         
         local tLineOffset
         put lineOffset(ImageUrlForHotLinking, tData) into tLineOffset
         put line tLineOffset of tData into tRemotePath
         replace ImageUrlForHotLinking with EMPTY in tRemotePath
         
         local tFileName
         set the itemDelimiter to SLASH
         put i & " - " & item -1 of tRemotePath into tFileName
         
         put URL tRemotePath into URL ("binfile:" & tLocalPath & SLASH & tFileName)
      end repeat
   end if
end mouseUp

Re: xkcd.com ripper

Posted: Sun Aug 25, 2013 9:26 am
by BvG
or you could buy the books :P

Re: xkcd.com ripper

Posted: Sun Aug 25, 2013 10:59 am
by shaosean
yeah, there is that option, but a hard drive takes up a certain amount of physical space regardless of the content on the drive, whereas physical books require an increasing amount of physical space as you acquire more, plus bringing along a collection of all the web comics I enjoy, is easier with a portable drive than 100 books ;-)

Re: xkcd.com ripper

Posted: Sun Aug 25, 2013 8:49 pm
by BvG
But.. you can't turn the page on your hard drive!

Re: xkcd.com ripper

Posted: Sun Aug 25, 2013 11:16 pm
by shaosean
I keep a piece of paper, folded in half, beside the laptop, so I simulate the thrilling experience of flipping pages, as well as getting the realistic battle action sounds associated with said action :-P

Re: xkcd.com ripper

Posted: Tue Aug 27, 2013 2:43 pm
by SparkOut
How does it cope with #1190 Time?

Re: xkcd.com ripper

Posted: Tue Aug 27, 2013 6:17 pm
by shaosean
It grabbed the picture, but for the other fun stuff you still need to visit the website ;-)