Open Enderchief opened 1 year ago
The easiest way is with the xkcd api.
This is the endpoint where {x}
is the number: https://xkcd.com/{x}/info.0.json
Here is a sample response from the api
{
"month": "1",
"num": 37,
"link": "",
"year": "2006",
"news": "",
"safe_title": "Hyphen",
"transcript": "{{Headline: My hobby: whenever calls something an [adjective]-ass [noun], I mentally move the hyphen one word to the right.}}\n[[One man is talking to another about a car that resembles a Volkswagen Beetle]]\nMan: Man, that's a sweet ass-car.\n{{Title text: I do this constantly}}",
"alt": "I do this constantly",
"img": "https://imgs.xkcd.com/comics/hyphen.jpg",
"title": "Hyphen",
"day": "1"
}
should fetch the xkcd by number