Reputation: 349
I have a website on which I want to post the current xkcd comic. xkcd provides a link for embedding, but each link has a unique name for each comic. For example, http://imgs.xkcd.com/comics/hotels.png is today's comic.
Is there any way to write a simple script to grab the latest comic from their website? Currently I'm just manually updating the URL on my site which is painful.
Upvotes: 0
Views: 421
Reputation: 359776
Randall provides RSS and Atom feeds for recent XKCDs. Parse one of those to get the latest comics.
Upvotes: 3
Reputation: 992707
Consider the problem for a moment. Where is the name of the current comic image shown? It's shown on the xkcd home page. You could write a script to retrieve the home page, search through the HTML for the current image link, and use that.
Upvotes: 1