diff --git a/specs/wiki-game/wiki-game.md b/specs/wiki-game/wiki-game.md index 36c227a6f19edd82801a656357bf4666fc85bcae..05d47c9bd81ae69ec9a5aeaaf87a01ab5cdc3a91 100644 --- a/specs/wiki-game/wiki-game.md +++ b/specs/wiki-game/wiki-game.md @@ -38,6 +38,18 @@ The string that comes before the next `"` character is the article being linked The full URL of an article is `https://en.wikipedia.org/wiki/ARTICLE`; for example, the URL for the Unicode article is https://en.wikipedia.org/wiki/Unicode. You can use Node.js's [`https.get()`](https://nodejs.org/api/https.html#https_https_get_options_callback) function to make the requests. +There are a few types of links that need special handling: +- Links to special Wikipedia pages, e.g. `href="/wiki/Template:Latin_alphabet_sidebar"`. + You can identify these links by the `:`. + They aren't real pages, so you should skip them. +- Links to sections on the same page, e.g. `href="#History"`. + You can identify these links by the `#` at the start of the link. + Again, since the link points to the same page, you don't need to follow it. +- Links to sections on other pages, e.g. `href="/wiki/Article_(grammar)#Indefinite_article"`. + You can identify these links by the `#` in the middle of the link. + To follow this link, remove the part starting with `#`. + In this example, that would be `/wiki/Article_(grammar)`. + ## Implementing the Wikipedia search The general idea is to start at the source article, follow each link to another Wikipedia article, and stop upon reaching the target article.