I can get a list of links in a Wikipedia article using
sortedLinks = WikipediaData["County", "LinksList"]; sortedLinks // Length
I need a list of links in order of their appearance in the article. I tried to write a function to extract the links from the article's code:
unsortedWikiLinks[title_String] := DeleteDuplicates@Append[ StringCases[WikipediaData[title, "ArticleWikicode"], "[[" ~~ link : Except["]" | "|", _] .. :> ToUpperCase[StringTake[link, 1]] <> StringDrop[link, 1]], title]
However, many links are missed because
"ArticleWikicode" does not parse the templates in the article.
unsortedLinks = unsortedWikiLinks["County"]; unsortedLinks // Length
The official Wikipedia API has an action to parse the templates, however I can't find this option in Mathematica's implementation.
How to get a list of links in order of their appearance with Mathematica?