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
1 answer

The wikipedia api seems to almost always get the word in question wrong

I'm using the wikipedia python library (https://pypi.org/project/wikipedia/), and in most cases, it seems to autocorrect the terms I'm using or something so that they're often wrong. For instance, "frog" gets changed to "food" and "crown" gets…
Will
  • 351
  • 4
  • 15
5
votes
1 answer

Case Insensitivity on Wikipedia API Calls

I am attempting to add case-insensitivity to my Wikipedia api calls. Wikipedia is case-sensitive in how it names pages. So, http://en.wikipedia.org/wiki/Cat will yield a page about the animal, http://en.wikipedia.org/wiki/CAT will yield a…
5
votes
1 answer

How to get a text of a specific section via wikipedia api

I would like to extract only a specific setion from a wikipedia page: example: I would like to extract the text from section "Parts" from wikipedia article "House". https://en.wikipedia.org/wiki/House The resulting text would be : Many houses have…
mcfly soft
  • 11,289
  • 26
  • 98
  • 202
5
votes
1 answer

Get wikitext from wikipedia API?

I'm looking at the API documentation here, https://www.mediawiki.org/wiki/API:Query Getting the wikitext for a page is mentioned in the beginning of the documentation, The action=query module allows you to get information about a wiki and the data…
Gabriel
  • 10,524
  • 1
  • 23
  • 28
5
votes
2 answers

How to Login to MediaWiki (Wikipedia) API in Node.js

I'm trying the Wikipedia client login flow depicted in the API:Login docs, but something wrong happens: 1) I correctly get a token raised with the HTTP GET https://en.wikipedia.org/w/api.php?action=query&meta=tokens&type=login&format=json and I get…
loretoparisi
  • 15,724
  • 11
  • 102
  • 146
5
votes
3 answers

Wikipedia : How "Did you mean" works and how to exploit it?

I want to know how does the "Did you mean : ..." of Wikipedia works and if there's a way, like with the API, to use it? Because I want to get the corresponding page from my input but this one could include errors. Example . Is there a query that…
Michaël
  • 3,679
  • 7
  • 39
  • 64
5
votes
1 answer

Using Wikipedia API continue parameter

I am using the wikipedia API to query for a search word, for example by making a GET request to this URL: https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&utf8=1&srprop=snippet&continue=&srsearch=Slovenia This query returns a…
Miha Šušteršič
  • 9,742
  • 25
  • 92
  • 163
5
votes
2 answers

How to extract links from "See Also" section of an article in Wikipedia?

Is there a way to extract all links from only the "See Also" section in a Wikipedia article through Wikpedia API? I wondering a method but I'm not able to find one.
Luca
  • 848
  • 1
  • 14
  • 33
5
votes
2 answers

How to get full Wikipedia revision-history list from some article?

How can I get the full Wikipedia revision-history list? (Don't want to scrape) import wapiti import pdb import pylab as plt client = wapiti.WapitiClient('mahmoudrhashemi@gmail.com') get_revs = client.get_page_revision_infos( 'Coffee',…
Abhishek Bhatia
  • 9,404
  • 26
  • 87
  • 142
5
votes
2 answers

How to list Wikipedia page titles with links using JSON?

This is my current code. It lists out page titles perfectly, but the links all return 'undefined'. function func(json) { var e = document.getElementById('wiki'); var i; for (i=0; i < json.query.allpages.length; i++) { e.innerHTML += i + ":…
isopach
  • 1,783
  • 7
  • 31
  • 43
5
votes
1 answer

Extract paragraphs from Wikipedia API using PHP cURL

Here's what I'm trying to do using the Wikipedia (MediaWiki) API - http://en.wikipedia.org/w/api.php Do a GET on http://en.wikipedia.org/w/api.php?format=xml&action=opensearch&search=[keyword] to retrieve a list of suggested pages for the…
Kane
  • 899
  • 2
  • 15
  • 35
5
votes
1 answer

wikipedia api search titles generator

Trying to search tiles through the api using a generator. I notice that there are two possible generators, with both I have problems: prefix search - doesn't work well if I have multiple words and the order is reversed in the query (for example…
Ilan lewin
  • 1,599
  • 1
  • 14
  • 24
5
votes
1 answer

Link terms on page to Wikipedia articles in pure JavaScript

While browsing I came across this blog post about using the Wikipedia API from JavaScript, to link a single search term to it's definition. At the end of the blog post the author mentions possible extensions including: A plugin which auto links…
Tim
  • 19,793
  • 8
  • 70
  • 95
5
votes
1 answer

How to get list of statements for a given Wikidata ID?

The only thing I managed to do is this link: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q568&format=jsonfm But this produces lots of useless data. What I need is to get all the statements for the given item, but I can't see any of…
rsk82
  • 28,217
  • 50
  • 150
  • 240
5
votes
7 answers

Scraping and Parsing a Wikipedia Page

I'm wondering if there are any existing libraries in or accessible from Objective-C that would allow me to scrape pages formatted like this one. Specifically, all of the dates and all of the text next to each date. If not, what would be the best way…