Jump to content

Retrieving all images from url (xkcd 1110)


iNko

Recommended Posts

There is this url - http://xkcd.com/1110/ . It has an interactive image, witch is made out of 225 other images (its very big). I want to make a php script that would download all those 225 images. For example - http://imgs.xkcd.com/clickdrag/1n8w.png. 1n8w.png is one of those images, if i write 1n9w.png it would load another image.

 

I think i do not explain myself well enough, so i am going to post how other ppl got the images but using other method:

 

This is what I did:

I figured out, that the map pieces follow the URL pattern

http://imgs.xkcd.com/clickdrag/X[n|s]Y[e|w].png,

where n, s, e, w are characters to select the quadrant, and X and Y are positive integers (>=1) with no zero padding. The images are each 2048×2048 pixels in size and are arranged in an orthogonal grid.

The bounds can be found in the JavaScript file http://imgs.xkcd.com/clickdrag/1110.js:

var size=[14, 48, 25, 33];

These are the bounds of [n, e, s, w] respectively, however, I did only find images for [13, 48, 19, 33], a little bit less in the n-s direction, but maybe I was missing something.

I did a brute force download of all the images (sorry Randall) using simple DOS shell commands like this for the s-e-quadrant:

FOR /L %x IN (1,1,25) DO FOR /L %y IN (1,1,48) DO wget http://imgs.xkcd.com/clickdrag/%xs%ye.png

I got 225 files that existed, all others are completely black or white and returned a 404-Not found.

 

I do not know what DOS shell is, or what those command lines are, i do understand what that code does tho. Is it possible to make something like this but with php?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.