75
11
Challenge
Given the number of an XKCD comic, output the title text of that comic (the mouseover text).
However, the program must throw an error when given the numbers 859
or 404
.
Rules
The number given will always be an existing comic (except 404
).
Your program must not throw an error for any other numbers than 859
or 404
.
For reference, comic 404
does not exist and 859
is:
Brains aside, I wonder how many poorly-written xkcd.com-parsing scripts will break on this title (or ;;"''{<<[' this mouseover text."
Url shorteners are disallowed. You may use the internet to get the title text.
Examples
Input > Output
1642 > "That last LinkedIn request set a new record for the most energetic physical event ever observed. Maybe we should respond." "Nah."
1385 > ::PLOOOOSH:: Looks like you won't be making it to Vinland today, Leaf Erikson.
1275 > If replacing all the '3's doesn't fix your code, remove the 4s, too, with 'ceiling(pi) / floor(pi) * pi * r^floor(pi)'. Mmm, floor pie.
1706 > Plus, now I know that I have risk factors for elbow dysplasia, heartworm, parvo, and mange.
Bounty
I will award a bounty to the shortest answer which fails on comic 859 because it's poorly written instead of checking for the number.
Your program may break on other alt texts (such as 744) providing they have unmatched parentheses, quotation marks etc.
Winning
Shortest code in bytes wins.
Is returning
null
valid as Error? – Roman Gräf – 2017-06-30T16:23:57.480@RomanGräf Uhh yeah, I think it can be – Beta Decay – 2017-06-30T16:25:07.257
Do we need to parse html entities like '? – thegreatemu – 2017-06-30T16:26:05.840
@thegreatemu Yes – Beta Decay – 2017-06-30T16:28:09.300
2
Since there are other comics with script-breaking alt texts (see 744), is it okay if a program breaks on those too?
– totallyhuman – 2017-06-30T17:16:21.4208@totallyhuman You should've added a slightly-NSFW-warning to that :P – HyperNeutrino – 2017-06-30T17:27:44.640
1@totallyhuman Yes, that's fine – Beta Decay – 2017-06-30T17:57:35.003
11Contradiction in the challenge: "must not throw an error for any other numbers than
859
or404
" and "may break on other alt texts". – aschepler – 2017-06-30T19:44:23.2603@aschepler The latter is only for the bounty – Beta Decay – 2017-06-30T20:58:31.387
1@BetaDecay this suggests the bounty may be applied to an answer that is invalid, inviting invalid answers. – trichoplax – 2017-07-02T08:14:06.497
1Or should the invalid code be included as an aside in a valid answer? – trichoplax – 2017-07-02T08:14:58.573
Isn't this likely to be akin unto a DDOS against the site? And thus should be done with permission? – Kzqai – 2017-07-05T00:08:56.590
4@Kzqai Good question, but I think you may be slightly underestimating how much traffic is involved in a DDOS, and also how much traffic xkcd.com already has. I wouldn't expect the traffic generated from answers here to be significant compared to either of those. – trichoplax – 2017-07-12T01:26:16.103