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
4
votes
2 answers

Python: return empty value on exception

I have some experience in Python, but I have never used try & except functions to catch errors due to lack of formal training. I am working on extracting a few articles from wikipedia. For this I have an array of titles, a few of which do not have…
puslet88
  • 1,288
  • 15
  • 25
4
votes
2 answers

Regex matching every character until a certain character ONLY if that certain character exists

Basically, I'm reading information from the Wikipedia API, which returns JSON code containing the source code for a page in their markdown. I used a JSON API to filter what I want from the page, and now I want to format the text in a way that…
Eli
  • 327
  • 4
  • 14
4
votes
2 answers

How to get a page actual content using page_id in Wikipedia api?

I retrieve the list of pages for a given category using Wikipedia API. However the pages are represented by their page_id. How can I get a page actual textual content by its page_id using Wikipedia API
HHH
  • 6,085
  • 20
  • 92
  • 164
4
votes
1 answer

How to retrieve Wikidata entry from Wikidata search results?

I make a Wikidata search request like this (autocomplete use case): https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&language=en&type=item&continue=0&search=photog And the service returns a JSON response thus { id:…
metalaureate
  • 7,572
  • 9
  • 54
  • 93
4
votes
1 answer

How can I harnest Wikidata to build a Siri-like service?

I'd like to discuss the first part of this Siri-like service. Ideally, I'd like to be able to query for things like: "the social network" "beethoven" "bad blood taylor swift" And get results like…
Vulkan
  • 1,004
  • 16
  • 44
4
votes
1 answer

How to retrieve biographical information of a person using Wikipedia's web API?

I am working on retrieving some particular bio details of a person from a Wikipedia page of that person through Wikipedia's web API. I need to retrieve the bio information box of a person. I found how to retrieve the content box , introduction…
Siva Kannan
  • 2,237
  • 4
  • 27
  • 39
4
votes
2 answers

How to extract the infobox vcard from wikipedia using the python wikipedia library

I have been trying to extract the infobox content using the wikipedia python package. My code is as follows (for this page): import wikipedia Aldi = wikipedia.page('Aldi') When I enter: Aldi.content I get the article text but not the infobox. I…
Michal
  • 1,863
  • 7
  • 30
  • 50
4
votes
4 answers

Wikipedia disambiguation error

I have recently been using the wikipedia module to determine a random wikipedia page. I have been doing this with a very large list of words, and the random.choice() module as so: words=open("words.txt","r") words=words.read() words=words.split() …
user2592835
  • 1,547
  • 5
  • 18
  • 26
4
votes
1 answer

Language independent link to a Wikipedia article with a language parameter

For instance I am writing an article in english about revision control that I would like to translate to several other languages. I would like to avoid manually translating the link to the Wikipedia article as the page name can be different in other…
4
votes
2 answers

Extracting data from Wikipedia

I am creating a Spring application and I have the need to integrate with Wikipedia. In particular, I would like to extract data on a given (large) set of Cities, e.g. country, website and coordinates. I am trying to understand which libraries or…
Manu
  • 4,019
  • 8
  • 50
  • 94
4
votes
1 answer

Accessing the Wikipedia Infobox image using python Wikipedia API

I want to access the Wikipedia infobox image for a given article title in a python program.Can someone please tell me how do I get that? The following snipped gives list of all images in the page.I want to access just the infobox image.How do I do…
user1985948
  • 291
  • 1
  • 13
4
votes
1 answer

RegEx needed for Wikipedia infobox

OK, so here's what I need : We have the full XML of a Wikipedia article We need just the Infobox section I have tried various things, but my main issue seems to be not being able to matching "internal" curly brackets. Any ideas (or any regex you…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
4
votes
2 answers

Wikipedia / MediaWiki API: Find if an article is about a person, organization or location

I'm trying to figure out if there's a way to determine whether a given article refers to a Person, Organization or Location. I imagine the answer lies somewhere in the "categories" and "clcategories" parameters... however, here's the issue. Take…
DanM
  • 7,037
  • 11
  • 51
  • 86
4
votes
1 answer

Full urls of images of a given page on Wikipedia (only those I see on the page)

I'd want to extract all full urls of images of "Google"'s page on Wikipedia I have tried with: http://en.wikipedia.org/w/api.php?action=query&titles=Google&generator=images&gimlimit=10&prop=imageinfo&iiprop=url|dimensions|mime&format=json but, in…
sparkle
  • 7,530
  • 22
  • 69
  • 131
4
votes
2 answers

API to get Wikipedia revision id by date

Is there any API to get wikipedia revision id by date, instead of checking all the revision history and extract out the most recent revision before that date? Thank you!
Leslie G
  • 309
  • 2
  • 10