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
14
votes
3 answers

Does the Wikipedia API support searches for a specific template?

Is it possible to query the Wikipedia API for articles that contain a specific template? The documentation does not describe any action that would filter search results to pages that contain a template. Specifically, I am after pages that contain…
grenade
  • 31,451
  • 23
  • 97
  • 126
14
votes
4 answers

No response from MediaWiki API using jQuery

I've tried to get some content from Wikipedia as JSON: $.getJSON("http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&titles="+title+"&format=json", function(data) { doSomethingWith(data); }); But I got nothing in…
diazath
  • 143
  • 1
  • 1
  • 4
13
votes
3 answers

How to know if the wikipedia content from API contains an useful article or an ambiguous one

I can get the Wikipedia article in XML or any other format. But for a term I want to know first if the returned text contains full article or simply contains ambiguous terms like the entered one. So "SEO" is an ambiguous(or redirect) term, but how…
AgA
  • 2,078
  • 7
  • 33
  • 62
13
votes
1 answer

How to obtain data in a table from Wikipedia API?

I'm trying to get all the content from Wikipedia:Unusual_articles and I'm able to get the list of table content by calling this endpoint: https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=sections&page=Wikipedia:Unusual_articles and…
John Lim
  • 3,019
  • 4
  • 31
  • 41
13
votes
4 answers

Wikipedia API: search for famous people

I have the following Wikipedia API search…
rybo111
  • 12,240
  • 4
  • 61
  • 70
13
votes
9 answers

Get the first lines of a Wikipedia article

I got a Wikipedia article and I want to fetch the first z lines (or the first x characters, or the first y words; it doesn't matter) from the article. The problem: I can get either the source Wiki text (via the API) or the parsed HTML (via a direct…
theomega
  • 31,591
  • 21
  • 89
  • 127
12
votes
2 answers

Wikipedia list=search REST API: how to retrieve also Url of matching articles

I'm studying Wikipedia REST API but I'm not able to find the right option to get also URLs for a search query. this is the URL of the…
Fabio Buda
  • 769
  • 2
  • 7
  • 16
12
votes
2 answers

Wikipedia api fulltext search to return articles with title, snippet and image

I've been looking for a way to query the wikipedia api based on a search string for a list of articles with the following properties: Title Snippet/Description One or more images related to the article. I also have to make the query using…
srosengren
  • 123
  • 1
  • 4
11
votes
2 answers

Wikipedia API: how to search for a term in a specific category

I'm having hard time to figure out a basic task: how to find a term restricted in a specific category.. i feel Wiki API documentation is kinda confusing... I'd just like to receive as output a JSON file with all the suggestions related to that…
Francesco
  • 24,839
  • 29
  • 105
  • 152
11
votes
4 answers

Fetch excerpt from Wikipedia article?

I've been up and down the Wikipedia API, but I can't figure out if there's a nice way to fetch the excerpt of an article (usually the first paragraph). It would be nice to get the HTML formatting of that paragraph, too. The only way I currently see…
Felix
  • 88,392
  • 43
  • 149
  • 167
11
votes
4 answers

Get first paragraph (and only text) of a Wikipedia article returns not desired result

I'm trying to retrieve the first paragraph of text for an article of Wikipedia, UNIX in this example, but it returns me a non-desired output. For what I've been reading on the Wikipedia api and here on StackOverflow, this is the request URL to make…
udexter
  • 2,307
  • 10
  • 41
  • 58
10
votes
3 answers

WebRequest to connect to the Wikipedia API

This may be a pathetically simple problem, but I cannot seem to format the post webrequest/response to get data from the Wikipedia API. I have posted my code below if anyone can help me see my problem. string pgTitle = txtPageTitle.Text; …
NickJ
  • 213
  • 1
  • 2
  • 6
10
votes
3 answers

How to access Wikipedia from R?

Is there any package for R that allows querying Wikipedia (most probably using Mediawiki API) to get list of available articles relevant to such query, as well as import selected articles for text mining?
mjaniec
  • 1,074
  • 1
  • 9
  • 12
10
votes
2 answers

How to get place description using Google API or any other API?

I am using Google API to get the place information and store it into database. Using Google API I am able to get address, opening hours, rating and reviews as shown in below image. But, I am not able to get place description which is highlighted in…
10
votes
2 answers

How to get all URLs in a Wikipedia page

It seems like Wikipedia API's definition of a link is different from URL? I'm trying to use the API to return all the urls in a specific wiki page. I have been playing around with this query that I found from this page under generators and…
gchao
  • 320
  • 1
  • 3
  • 8
1 2
3
72 73