wikipedia-api

Access-Control-Allow-Origin with Wikipedia API with Javascript

▼魔方 西西 提交于 2019-12-23 16:50:46
问题 Trying to receive a response from the Wikipedia API on Codepen. The reply should be a json which i'm trying to console.log. In the console however I see an error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://en.wikipedia.org/w/api.php?action=opensearch&search=earth&format=json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). I've read quite a bit over the past few days about CORS and Allow-Origin to try to understand but

How to get internal link from latest revision of a wikipedia page?

吃可爱长大的小学妹 提交于 2019-12-23 02:57:07
问题 I'm trying to extract internal links from wikipedia pages. This is the query I'm using /w/api.php?action=query&prop=links&format=xml&plnamespace=0&pllimit=max&titles=pageTitle However, the result does not reflect what's on the wiki page. Take for example a random article here. There are only a dozen of links on this page. However, when I make the query, /w/api.php?action=query&prop=links&format=xml&plnamespace=0&pllimit=max&titles=Von_Mises%E2%80%93Fisher_distribution I got back 187 links. I

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

纵然是瞬间 提交于 2019-12-22 07:46:25
问题 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 the statements in the query above. here it will be: { "instance of" : "chemical element", "element symbol" : "Li", "atomic number" : 3, "oxidation state" : 1, "subclass of" : ["chemical element", "alkali metal"] // etc... } Is there an API for this

Download images with MediaWiki API?

人走茶凉 提交于 2019-12-22 06:28:35
问题 Is it possible to download images from Wikipedia with MediaWiki API? 回答1: No, it is not possible to get the images via the API. Images in a MediaWiki are stored just in folders, not in a database and are not delivered dynamically (more information on that in the Manual:Image administration). However, you can retrieve the URLs of those image files via the API. For example see the API:Allimages list or imageinfo property querymodules. Then you can download the files from those URLs with your

Retrieve a list of all Wikipedia languages programmatically

我与影子孤独终老i 提交于 2019-12-22 05:35:16
问题 I need to retrieve a list of all existing languages for a certain wiki project. For example, all Wikivoyage or all Wikipedia languages, just like on their landing pages. I prefer to do this via MediaWiki API , if it's possible. Thanks for your time. 回答1: Approach 3: Using an API in the Wikimedia wiki farm and Extension:Sitematrix https://commons.wikimedia.org/w/api.php?action=sitematrix&smtype=language While this will return all wikis, the matrix knows about, it is easily filtered client side

wikipedia api: get parsed introduction only

岁酱吖の 提交于 2019-12-21 22:55:55
问题 Using PHP, is there a nice way to get the (parsed) introduction only from a wikipedia page? I have to current methods: The first is to call the api page and return, then call the Wiki parser on the introduction I have pulled from the first request (two requests, extracting the intro from the text isn't pretty either). The second is to call the entire page parser and use xpath to retrieve every <p> tag before the contents table. With both methods I then have to re-parse the HTML to ensure the

Get location with Wikimedia API

假如想象 提交于 2019-12-21 20:58:44
问题 How to get location of the Wikipedia article with Mediawiki API in terms of city/country? Let's say I want to determine what country, what city the Sagrada Familia cathedral is located in? What property should I use? 回答1: Try the following query: https://en.wikipedia.org/w/api.php?action=query&prop=coordinates&titles=Sagrada%20Fam%C3%ADlia&coprop=country|type|name|dim|region And see Extension:GeoData for documentation. I'm not sure if we can get the city name using Wikipedia API, but there

How can I get the principal image from MediaWiki API?

社会主义新天地 提交于 2019-12-21 17:16:11
问题 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 (http://en.wikipedia.org/wiki/English_language) I should go to this URL: http://en.wikipedia.org/w/api.php?action=query&titles=English_Language&prop=images but I receive flags of countries where people speak English in XML: <?xml version="1.0"?>

Fetch famous people from Wikipedia API

感情迁移 提交于 2019-12-20 03:54:24
问题 I'm trying to fetch people who are still alive from Wikipedia API but I haven't figured out how to do it. I found this question which is the same as mine and as far as I understood the only way is to search for people who only have the birth_date parameter, how do I actually do that? For instance, if I wanted to search for "Ronaldo", I should get a list of all people called Ronaldo who are still alive. The only data I care about are date of birth, name and surname, and eventually date of

API to get Wikipedia revision id by date [closed]

冷暖自知 提交于 2019-12-19 10:04:46
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . 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! 回答1: The revision query api allows you to pass timestamps to get only revisions from a specified interval. Use api.php?action=query&prop