The wikipedia Page View API provides information about the number of page views for a given article, including an option to view top-N articles in a given day or month:


I would like to filter these top-N rankings by removing articles about people such as celebrities, politicians etc.

Is there a way to obtain metadata information about an article that would contain such classifications?

1 Answer 1


I don't think it's possible to filter articles by topic with a single query in the API. However, you can use Wikidata to detect and filter politics, celebrities and so. You'll need to follow several steps:

  1. Get articles from the query you gave in the question.
  2. Query English language Wikipedia to get Wikidata item for each article.
  3. Query Wikidata to get statements about the item.
  4. Decide if you want the article to be included depending on the statements you got.

There are different tools for each step, but the most critical one is step 4. You'll lucky if most politicians have occupation:politician but there will likely be several occupation tags for celebrities.

Using categories from Wikipedia is another option but I won't advise to take it due to the structure of categories - a category of actors can have subcategories with actors along with subcategories with films, for example.

  • Lots of work to do for client code: 2. Get Wikidata Item for the given article 3. Query Wikidata for the specified item 4. Filter based on Wikidata item properties: instanceof human, occupation = 'film producer' Mar 2, 2017 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.