Skip to content

Instantly share code, notes, and snippets.

@BlakeWilliams
Created June 25, 2011 02:16
Show Gist options
  • Save BlakeWilliams/1046029 to your computer and use it in GitHub Desktop.
Save BlakeWilliams/1046029 to your computer and use it in GitHub Desktop.
XKCD Downloader
require 'httparty'
1.upto(916) {|x| File.open('./xkcd2/'+x.to_s+'.jpg','w') {|f| f.write(HTTParty.get('http://imgs.xkcd.com/comics/' + HTTParty.get('http://xkcd.com/'+x.to_s).body.match(/(?<=src\="http:\/\/imgs\.xkcd\.com\/comics\/).*?(?=")/).to_s))}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment