mediawiki-api

Retrieve a list of all Wikipedia languages programmatically

徘徊边缘 提交于 2019-12-05 06:59:30
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. 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 by code [as of now, one of: wiki (Wikipedia), wiktionary , wikibooks , wikinews , wikiquote , wikisource ,

Get an article summary from the MediaWiki API

↘锁芯ラ 提交于 2019-12-04 22:28:19
I am looking for a mediawiki api using which I can get short description about any query string. For example , if I search for Nicolas Cage then it should return the short description for him. I tried http://en.wikipedia.org/w/api.php?%20format=json&action=query&titles=Nicolas%20Cage&prop=revisions&rvprop=content I am not sure if prop=revisions is right. My intention is to get a short description on the final version of the page. Also I need another api which can give the link of the wikipedia page (web / mobile) from the query string. i.e. For Nicolas Cage, http://en.wikipedia.org/wiki

How can I use the Wiktionary API for getting pronunciation data? [closed]

为君一笑 提交于 2019-12-04 20:23:34
问题 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 . I was looking for a way to get the pronunciation of any given word by querying an API of some sort. As Wiktionary comes in handy to find pronunciations of words I was trying to use their API, but how do I get the pronunciation of a specific word? It seems their API only allows getting the entire Wiki article. 回答1:

No 'Access-Control-Allow-Origin' header is present. Origin is therefore not allowed access

冷暖自知 提交于 2019-12-04 14:48:54
EDIT: No JSONP! Yes i know CORS is handled by the server and Yes the server does support it. The issue is on my side. I am trying to use MediaWiki API from the browser. I am sending a GET request through XMLHttpRequest but due to CORS issues it's just not working. I am getting the following message from my browser after it receives the response: XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?format=json&action=query&list=search&srsearch=Oculus&utf8 . No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://127.0.0.1:8000 ' is therefore not

How do I log into mediawiki using PHP cURL?

故事扮演 提交于 2019-12-04 12:17:18
I'm trying to integrate mediawiki into my website, but I'm having trouble. I think the problem has something to do with the cookies because I get a success from the mediawiki API. Here's my code: function mw_session_manager($Action = "") { $Root = $_SERVER['SERVER_ADDR']; $API_Location = "${Root}/w/api.php"; $expire = 60*60*24*14 + time(); $CookieFilePath = tempnam("/tmp/thedirectory", "CURLCOOKIE"); $CookiePrefix = 'theprefix'; $Domain = 'thedomain'; if($Action == 'login') { // Retrieves email address and password from sign-in form $Email = $_POST['LogInEmail']; $LgPassword = $_POST[

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

半世苍凉 提交于 2019-12-04 11:15:03
问题 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 request: http://it.wikipedia.org/w/api.php?action=query&list=search&srsearch=calvino&format=xml&srprop=snippet this request outputs only the Title and the Snippet but no URLs for articles. I've checked wikipedia API documentation for the list=search query but seems there is no option to get also URLs. Best Regards, Fabio Buda 回答1: You can form the URL of the

wikipedia api search titles generator

∥☆過路亽.° 提交于 2019-12-04 10:59:55
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 "brian adams" would return an answer, however "adams brian" does not search - seems to not allow searching by titles, only by text which returns low-quality results. Anyone knows of a way around this? "srwhat=title" is disabled, so you should use "intitle:" in your search query: https://en.wikipedia.org/w/api.php?action=query&list=search&srnamespace=0

How can I get the principal image from MediaWiki API?

我与影子孤独终老i 提交于 2019-12-04 07:16:59
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"?> <api> <query> <normalized> <n from="English_language" to="English language" /> </normalized> <pages>

How to get image URLs in different pages using a single WIKI api call?

拜拜、爱过 提交于 2019-12-04 05:34:02
问题 We can get text extract of different pages in a single wiki api call by using pipe character ( | ). For eg : http://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exlimit=max&explaintext&exintro&titles=Yahoo|Google&redirects= By using this api call, we can get datas about Google and Yahoo in text format. Here we get datas of both Google and Yahoo in a single api call. I want to get image urls of both Google and Yahoo in a single wiki api call. Is there any method to get all

Wikipedia API: how to get the number of revisions of a page?

馋奶兔 提交于 2019-12-04 03:12:48
Anyone know how to get the number of revisions of a wikipedia page using mediawiki API? I have read this API documentation, but can't find the related API: Revision API The only possibility is to retrieve all revisions and count them. You might need to continue the query for that. Bug 17993 is about including a count, but is still unsolved. Here is code to get number of revisions of a page (in this case, the JSON wiki page ): import requests BASE_URL = "http://en.wikipedia.org/w/api.php" TITLE = 'JSON' parameters = { 'action': 'query', 'format': 'json', 'continue': '', 'titles': TITLE, 'prop':