Fixed link to current comic would be handy...

Need the mods or admins to do something for you? Post here. Read the "About" post first.

Moderators: Magistrates, Prelates, Moderators General

Fixed link to current comic would be handy...

Postby ScottM » Tue Nov 29, 2011 9:35 pm UTC

Oddish request... I'd like there to exist a simple, fixed url which always fetches the current comic image. Something along the lines of
img.xkcd.com/recent.png
My reason for this is that I want to write code to hit this link every 4 days (getting a different image each time) and use the bits of the fetched image to permute the state of a PRNG.

I know I could do this with the existing JSON url, but it's easier (for me) if I can do it in one fetch. (But I'm not... lazy).

I do not need a carefully worded explanation that anyone who writes his own PRNG code, AND wants to seed it with xkcd, has compounded his geekishness to a worrisome extent. I know. What makes it all worse is that the PRNG output is used in a roleplay game. (Yes, I know. The drugs don't actually help. Thanks.) I also know there are many webcams out there that provide much better sources of unpredictability; I'm already using some. But without xkcd, it just doesn't feel like I've pushed the concept to the maximum possible point.

(Of course, if I can ask for
xkcd.com/hashRecent
returning a sequence of digits representing a hash of the current comic, that'd be great, too. But then I'd at least like a discussion of which hash algorithm would be most suitable for this sort of art. :D Thanks!)
ScottM
 
Posts: 3
Joined: Wed Jan 07, 2009 6:14 pm UTC

Re: Fixed link to current comic would be handy...

Postby theGoldenCalf; » Tue Dec 13, 2011 8:47 am UTC

Maybe someone who compounded his geekishness to a worrisome extent can parse the HTML response from xkcd.com and extract the image link. Maybe.
それは彼女が言ったことだ!
User avatar
theGoldenCalf;
 
Posts: 257
Joined: Sun Feb 14, 2010 7:16 am UTC
Location: Elbow deep inside the borderline

Re: Fixed link to current comic would be handy...

Postby Zarq » Tue Dec 13, 2011 9:41 pm UTC

Just checked, the comic link is the only link of the form "http://imgs.xkcd.com/comics/.*"

Indeed not difficult to extract.
You rang?

"It is better to shit yourself, than to die of constipation." - Some picture on reddit
User avatar
Zarq
 
Posts: 2001
Joined: Mon Jul 26, 2010 7:29 pm UTC
Location: Third Rock from Earth's Yellow Sun

Re: Fixed link to current comic would be handy...

Postby phlip » Wed Dec 14, 2011 8:45 am UTC

Ew, no, don't parse the HTML, the JSON is there for a reason. Exactly why that's not sufficient for the OP's purposes is unclear.
Code: Select all
enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]
User avatar
phlip
Restorer of Worlds
 
Posts: 7328
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia

Re: Fixed link to current comic would be handy...

Postby davean » Thu Dec 15, 2011 10:13 am UTC

And the JSON contains the rest of the comic info. There is more to a comic then just an image.
User avatar
davean
Site Ninja
 
Posts: 2455
Joined: Sat Apr 08, 2006 7:50 am UTC


Return to Site/Forum issues

Who is online

Users browsing this forum: No registered users and 0 guests