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

Get random SVG image using MediaWiki API

Is it possible to use the MediaWiki API to return a random image? If so can I specify a filetype such as SVG?
Tim
  • 71
  • 1
  • 7
2
votes
1 answer

Wikipedia API for Python: how can I get the item ID from a corresponding page?

I am using Wikipedia-API 0.5.4, and I would like to retrieve the item ID for the item being discussed on a given page. Is it possible to do this using the data returned from a page query? I am able to retrieve the pageid. However, pages in different…
Tashus
  • 207
  • 2
  • 9
2
votes
1 answer

Too many re-renders. React limits the number of renders to prevent an infinite loop - why?

I'm trying to divide results into categories from a search using Wikipedia API. Here is my Search component: function Search() { const [value, setValue] = useState(""); const [results, setResults] = useState([]); useEffect(() => { …
DMQuinn
  • 59
  • 5
2
votes
2 answers

How to list all anonymous (so IP-public) edits made to Wikipedia from a specific IP address?

Lets say I have an IP address, for example the IP address of the Hungarian Parliament: 193.224.28.151 How can I get a list of all Wikipeida edits made using this IP address? On a Tom Scott webpage, I read: Here's a fact: Wikipedia stores the IP…
zabop
  • 6,750
  • 3
  • 39
  • 84
2
votes
2 answers

"En dash" being garbled during http response handling or text manipulation

I'm writing code to work with text from Wikipedia and am having issues with en dashes being garbled. I haven't worked with en dashes or other non-standard characters before (non-standard to me being character that don't appear on my keyboard ;), so…
2
votes
2 answers

Python Split string after 2000 characters

I'm working on a discord bot that can return the summary of Wikipedia articles. but there's an issue, some summaries are longer than 2000 characters, which exceeds discord's character limit. is there a way I can split my string into multiple…
Chrookie
  • 23
  • 4
2
votes
3 answers

Can I get a version of a Wikipedia page as of specified date?

I am trying to access old version of Wiki pages using data instead of "oldid". Usually to access and a version of a wiki page, I have to use the page id like this https://en.wikipedia.org/w/index.php?title=Main_Page&oldid=969106986, is there a way…
2
votes
3 answers

Using wikipedia module in python

I am using wikipedia module in my python code. I would like to have an input from user to search from wikipedia and get 2 lines from its summary. Since there might be many topics with same name, I used like this. import wikipedia value=input("Enter…
2
votes
2 answers

How to get Wikipedia content using Wikipedia's URL?

Is it possible to create an input field where you can paste a Wikipedia page link and it will get all the text contents from that page? I'm trying to integrate a feature on my web application where people can paste their Wikipedia page link/URL they…
2
votes
1 answer

Wikipedia api python returns weird results

import wikipedia print(wikipedia.summary("Tomato", sentences=3)) Why does this code return a disambiguation error with "tom tom" and not just a summmary/disambiguation error to the entry "tomato"? The search term is clearly not tom tom or am I…
2
votes
1 answer

Python OSError: [Errno 9] Bad file descriptor after opening big json file

I just tried to read in a big json file (the Wikipedia json dump) in Python line by line and got the Error: Traceback (most recent call last): File "C:/.../test_json_wiki_file.py", line 19, in test_fct() File…
LaLeLo
  • 137
  • 1
  • 9
2
votes
1 answer

How to access a property whose name consists of an asterisk in PowerShell?

The wikipedia API returns JSON that contains an element with the name *. How can I access such a property in PowerShell? Example: $json = Invoke-RestMethod -Method Get -Uri…
stackprotector
  • 10,498
  • 4
  • 35
  • 64
2
votes
1 answer

Extracting table data from wikipedia API

I need to extract the table at the right side for any politician from wikipedia. I tried to use the wikipedia API for this purpose. But I was not able to extract the table data. The code I have tried so far is as follows : import wikipedia person =…
Suraj
  • 2,253
  • 3
  • 17
  • 48
2
votes
1 answer

PHP + Wikipedia: Get content from the first paragraph in a Wikipedia article?

I’m trying to use Wikipedia’s API (api.php) to get the content of a Wikipedia article provided by a link (like: http://en.wikipedia.org/wiki/Stackoverflow). And what I want is to get the first paragraph (which in the example of the Stackoverflow…
2
votes
1 answer

MediaWiki API: How to get an article's list of editors

As part of the WP:ASE project, I want to get the list of editors that have edited a given article. For instance, for the article Szklarka Mielęcka (history) that would be: Kotbot, AnomieBOT, Xenobot I could not find anything in the MediaWiki…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373