How to get all city pages from Wikipedia using the LINQ-to-Wiki?

I used the LINQ-to-Wiki to get Wikipedia pages on my ASP.NET MVC webapplication. I used the query below to get pages called "India."

var wikipedia = new Wiki("Example"); var data = wikipedia.Query.allpages() .Where(i => i.prefix == "India") .ToList(); 

But he gives all the pages related to India, not just Places / Cities. How to get only "Places / Cities" from this query? Or how to search for a place by the "categorymembers" property. Can anybody help?

+6
source share
1 answer

Check out this other SO answer: Wikipedia API - is there a general category of music? .

OpenSearch's Wikipedia implementation does not support categories in search text.

0
source

Source: https://habr.com/ru/post/975826/


All Articles