How can the categories of a wikipedia page be found using only page links?

Is there any API that can be used to get all page categories using the title or id of the page or the url of that page? I tried searching the net, but all I could find was getting dumps for certain categories. Any help would be much appreciated. Thanks to

+3


source to share


2 answers


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

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

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



If you want to use this in a program it might be worth taking a look at the following Wikipedia page which has a series of classes and libraries for different languages ​​to handle the Wikipedia API etc

Wikipedia: Creating_a_bot # Programming_languages_and_libraries

+7


source


MediaWiki (Wikipedia software) has an API and you can actually make a request to get the page categories. For example, the following returns the categories of Google

an English Wikipedia page :

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

Please note that not all categories are returned in the same response. You will see an element with a name query-continue

that provides more information on how the next query should be phrased, which will give you more categories.



Literature:

+6


source







All Articles