Questions tagged [wikipedia-api]

Related to the use of the MediaWiki API on Wikipedia. Consider also the tags [wikipedia] if your question isn't about the API or [mediawiki-api] if your question isn't about Wikipedia.

Documentation for the API is available at mediawiki.org; a summary of all available parameters and short help is available by accessing the API endpoint on the wiki.

In addition, there is a REST API that allows fetching commonly used data in a simple format. A list of all endpoints can be found in the REST API Documentation.

Please make sure to read the etiquette for best practices for using the API and general usage guidelines.

1085 questions
5
votes
5 answers

How can I get the principal image from MediaWiki API?

Hello I'm using Curl to get information from Wikipedia,and I want to receive only information about the principal image,I don't want to receive all images of an article.. For example.. If I want to get info about all images of the English Language…
Carlos
  • 177
  • 1
  • 3
  • 8
4
votes
2 answers

Wikipedia API: how to retrieve multiple titles AND resolve redirects in 1 call?

It appears from the MediaWiki API:Query page that you can only resolve a redirect one at a time. The document even says "The example below isn't really useful because it doesn't use any query modules, but shows how the redirects parameter…
BobR
  • 273
  • 3
  • 10
4
votes
1 answer

What is the best way to parse Wikipedia markup in PHP?

I'm trying to parse specific Wikipedia content in a structured way. Here's an example page: http://en.wikipedia.org/wiki/Polar_bear I'm having some success. I can detect that this page is a "specie" page, and I can also parse the Taxobox (on the…
Fer
  • 4,116
  • 16
  • 59
  • 102
4
votes
1 answer

How to get the number of languages a Wikipedia page is available in? (SPARQL query)

I'm trying to have a list of Italian books from the 1980 on and the number of Wikipedia pages their original Wikipedia page has been translated into, for instance I would like to have: Book, number The name of the Rose, 5 Where 5 is the number of…
4
votes
1 answer

Trying to retrieve the first image on Wikipedia pages using Wikipedia API - isn't working specifically for articles on video games?

I am attempting to retrieve box art for video game titles from Wikipedia using a GET query and the Wikipedia API. I am using the below query string which seems to be working fine for any other article, such as for the article about the…
4
votes
2 answers

Get more general Category from the Category of a Wikipedia page

I'm using Python wikipedia library to obtain the list of the categories of a page. I saw it's a wrapper of MediaWiki API. Anyway I'm wondering how to generalize the categories to marco categories, like these Main topic classifications. For example…
4
votes
2 answers

How to use Wikipedia API to find specific person in the page lists about people with the same name

Let's say I have a list of Astronauts and I want to display their biographies using Wikipedia API. So far I've tried this one: https://en.wikipedia.org/w/api.php?action=parse&prop=wikitext&page=Nick%20Hague Works as expected. But take a look at…
Mosrainis
  • 470
  • 6
  • 14
4
votes
1 answer

Inlinks and outlinks for a Wikipedia page in python

I am using the Wikipedia API for python to get page links as follows: import wikipedia ny = wikipedia.page(wikipedia.search("Barack Obama")[0]) print ny.links This ny.links provides all the links (inlinks and outlinks together), but I need them…
Krishnendu Ghosh
  • 314
  • 4
  • 21
4
votes
1 answer

Searching for files in Wikimedia / Wikipedia

I'm trying to search for specific file types in Wikimedia commons API with not much of luck. Current status: I'm currently able to fetch images with jpeg, png, svg formats normally using this query…
4
votes
1 answer

How to get IMDb ID for some film article from the Russian Wikipedia?

I'm collecting data about some films in Russian and, using Wikipedia API, I can query data about required film in JSON format: https://ru.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvprop=content&titles=%s where %s is a title…
cybersoft
  • 1,453
  • 13
  • 31
4
votes
2 answers

Wikipedia API and SPARQL in a single query

I need to search for Wikipedia pages that contain some specific words in their full text. To improve the results I want to limit the results to pages describing entities that are instances of a specific entity. For searching the full text I can use…
BPas
  • 99
  • 5
4
votes
2 answers

How to use Wikipedia API to get page statistics for all pages in a Category?

I am looking to identify the most popular pages in a Wikipedia Category (for example, which graph algorithms had the highest page views in the last year?). However, there seems to be little up-to-date information of Wikipedia APIs, especially for…
4
votes
1 answer

MediaWiki api - get last changes

How can i get the list of all pages, that were changed since some date using mediawiki api? EDIT: I have already found this query:) F.e. for wikipedia http://en.wikipedia.org/w/api.php?action=query&list=recentchanges&rclimit=500&rcnamespace=0
Le_Coeur
  • 1,521
  • 5
  • 28
  • 44
4
votes
1 answer

How to reliably get the image used in the Wikipedia Infobox?

How do I (reliably) get the main image(s) used in the Wikipedia Infobox from the API? This question has been asked before and the accepted answer admits that it is just a guess. Subsequent answers seem like a hack, at best and don't return the…
user776942
4
votes
2 answers

How to get title of landmark place from Wikipedia by API?

For my code I am using the Wikipedia API which provides links to all places that are linked with the Wikipedia article of that city. But with my code there are some extra unnecessary links. I want to only return links where the type is…
harry.luson
  • 247
  • 7
  • 19