Share your repls and programming experiences

← Back to all posts
Web-Scraping-XKCD903
h
timmy_i_chen

Here's a fun little project that puts that old XKCD comic to test: Repeatedly navigating to the first non-parentheses non-italics link in a wikipedia article will eventually lead you to Philosophy. It starts at a random article (but you can totally choose its starting point by changing line 64.

When I hand-tested this myself many years ago when I should've been paying attention in school, it definitely worked. Sadly, it seems to no longer be the case - although now, it seems as though all articles eventually lead to Mathematics... which I suppose also works.

https://repl.it/@timmy_i_chen/Web-Scraping-XKCD903

Link to original comic (hover over the image to see the alt-text):
https://xkcd.com/903/

Voters
programmertest2
LordPancake
SCollierCode
gramatgesj21
selroh18
AmeliaPhillips
stefanfellows
SamiRahman1
R2
SpicyMemesKid
Comments
hotnewtop
pyelias

I'm coming for you! 42 votes and counting right now.

Codemonkey51

:( it no longer works

ebest

I put in Mathematics but it didn't work. Output:

That was errors included, but it "Looks like it didn't work. Super sad. :("

masonclayton

seems like all roads lead to /wiki/Mathematics now

Spandan14

Nice, but what is the usage?

HaydenC1

-_-

rileyball2

Change Philosophy to mathematics (like I did in a branch) and it works almost 100% of the time

CyanCoding

Awesome! I also made my own version of this (it scrapes regular wiki pages though): https://repl.it/@CyanCoding/Wiki-Web-Scraper

serdav74

Nice! Though there is a problem: it crashes when the first link leads to external website (like wiktionary)
https://puu.sh/zmUoa/3b90af9a9e.png

TimmyChen1

@serdav74: Ooooo, that shouldn't happen, it's in parentheses! Thanks for letting me know - I'll try to fix it :D

Gymnast456

@timmy-chen: Do you know how I can add an image to python with turtle??

timmy_i_chen
Case_Buttitta

Nice

SomeRandomGuy

"Traceback (most recent call last):
File "python", line 99, in <module>"

Every time I run it. Please fix it
IndexError: list index out of range"

TimmyChen1

@somerandomguy: Added a quick conditional to break out of the loop if the index runs out of bounds. Thanks for letting me know :)

SomeRandomGuy

@timmy-chen: Np

426729

It's all leading to Philosophy. This is a great program! Keep up the great work!

DarthVader1

all roads lead to science

NicholasChorett

..but whats the point of this...? sry im dumb

SCollierCode

@nicholaschorett: It has no real, meaningful purpose. However, it is a funny reference to XKCD, a popular web comic, and it tests a rather old joke/piece of trivia. So in the grand scheme of things, there is no point, but if you're a fan of XKCD or just computer-based jokes and "tech" culture in general it may be of some relevance and/or interest.