Skip to content

Instantly share code, notes, and snippets.

@Dru89
Created September 4, 2014 21:47
Show Gist options
  • Save Dru89/0d8376f81068825690d0 to your computer and use it in GitHub Desktop.
Save Dru89/0d8376f81068825690d0 to your computer and use it in GitHub Desktop.
Get all the images from http://xkcd.com/1416/
# Get all the images from http://xkcd.com/1416/
import urllib2
import json
ids = []
def process(id):
if id in ids: return
ids.append(id)
data = json.loads(urllib2.urlopen("http://c.xkcd.com/turtle/{}".format(id)).read())
for id in data.get("white", []):
process(id)
for id in data.get("black", []):
process(id)
process('turtles')
print "\n".join(map(lambda id: "https://sslimgs.xkcd.com/turtledown/{}-tiled".format(id), sorted(ids)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment