Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can one find categories of a wikipedia page using just links of pages?

Is there any API by which one can get all the categories of a page using the title or page id or url of that page? I tried searching on net but all I could find was getting dumps for specific categories. Any sort of help will be highly appreciated. Thanks

like image 254
user1276381 Avatar asked Mar 18 '12 00:03

user1276381


People also ask

How do I find categories on Wikipedia?

Categories are used in Wikipedia to link articles under a common topic and are found at the bottom of the article page. Clicking the category name displays a list of articles in that category, below a list of sub-categories (categories in that category) (if any).

How do I find where a Wikipedia page is linked to?

Within the Toolbox section on the left-hand side of every page is a link labeled "What links here". This is used to see a list of the pages that link to (or redirect to, or transclude) the current page. These are sometimes referred to as backlinks.

How many categories are there in Wikipedia?

The article categories are separated into nine major groups: Everyday life, Geography, History, Knowledge, Language, Literature, People, Religion, and Science. Each of these groups is separated into smaller groups or sub-categories which have even smaller groups inside them.


1 Answers

The API you are looking for is here https://en.wikipedia.org/w/api.php This is the media wiki API and has lots of documentation.

As said above you are looking for prop=categories so... ?format=xml&action=query&prop=categories&titles=Google for example

https://en.wikipedia.org/w/api.php?format=xml&action=query&prop=categories&titles=Google

If you are looking to use this in a program it may be worth looking at the following Wikipedia page that has a series of classes and libraries for various languages to deal with handling the Wikipedia API e.t.c

Wikipedia:Creating_a_bot#Programming_languages_and_libraries

like image 85
mr.user1065741 Avatar answered Dec 28 '22 20:12

mr.user1065741