wikipedia-api

API to get Wikipedia revision id by date [closed]

拥有回忆 提交于 2019-12-01 09:16:04
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! Bergi The revision query api allows you to pass timestamps to get only revisions from a specified interval. Use api.php?action=query&prop=revisions&rvlimit=1&rvstart= myTimestamp Check out the Manual:WfTimestamp for accepted formats - yyyymmddhhmmss always works. Building on the previous answer: The always accepted format yyyymmddhhmmss returned errors. This example returned a valid response: JSON XML The id in field revid

MediaWiki URL parameters without values

删除回忆录丶 提交于 2019-12-01 04:44:28
The query part of a URL seems to consist of key-value pairs separated by & and associated by = . I've taken to always using jQuery's $.param() function to URL-encode my query strings because I find it makes my code more readable and maintainable. In the past couple of days I find myself calling the MediaWiki API but when cleaning up my working prototype with hard-coded URLs to use $.param() I noticed some MediaWiki APIs include query parameters with keys but not values! api.php ? action=query & titles=Main%20page & redirects Notice the part &redirects , which takes no value. jQuery's $.param()

Wikipedia API for python

霸气de小男生 提交于 2019-12-01 03:09:24
I am trying to see the table of contents in a wikipedia page using Wikipedia API for python. Here is my code. >>> import wikipedia >>> ny = wikipedia.page("New York") >>> ny.sections But I am getting an empty list [] as the result. When I go to the page and check, I can see that there is content in the table of contents. All the other things said in the documentation seem to work except this. I am new to python coming from a java background. There is a bug in the current version of the Wikipedia API python library. You can install a branch by lucasdnd on github that fixed this: pip install git

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

懵懂的女人 提交于 2019-11-30 23:28:23
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', 1000000) print len(gen_revs) 500 Package link: https://github.com/mahmoud/wapiti If you need more than 500 revision entries you will have to use MediaWiki API with action query , property revisions and parameter rvcontinue , which is taken from the previous request, so you can't get the whole list only with one request: https://en.wikipedia.org/w/api.php?action

Wikipedia API for python

我只是一个虾纸丫 提交于 2019-11-30 22:28:40
问题 I am trying to see the table of contents in a wikipedia page using Wikipedia API for python. Here is my code. >>> import wikipedia >>> ny = wikipedia.page("New York") >>> ny.sections But I am getting an empty list [] as the result. When I go to the page and check, I can see that there is content in the table of contents. All the other things said in the documentation seem to work except this. I am new to python coming from a java background. 回答1: There is a bug in the current version of the

Retrieve another language of a Wikipedia page

喜欢而已 提交于 2019-11-30 22:27:19
Task: We have Wikipedia English page and need to retrieve the same page address in Russian. I know the Semantic Web solution - use simple query to DbPedia, but I am curious whether there are traditional solutions. I have asked the same question in semanticoverflow.com where Toby Inkster suggested to parse http://en.wikipedia.org/wiki/Colugo?action=raw results (there are other languages links in the bottom), but this way is too inefficient. Are there any other ways or DbPedia is the one real option? Wikipedia has an extensive API , which can provide language links information among others. In

Retrieve another language of a Wikipedia page

故事扮演 提交于 2019-11-30 17:52:53
问题 Task: We have Wikipedia English page and need to retrieve the same page address in Russian. I know the Semantic Web solution - use simple query to DbPedia, but I am curious whether there are traditional solutions. I have asked the same question in semanticoverflow.com where Toby Inkster suggested to parse http://en.wikipedia.org/wiki/Colugo?action=raw results (there are other languages links in the bottom), but this way is too inefficient. Are there any other ways or DbPedia is the one real

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

故事扮演 提交于 2019-11-30 17:26:28
问题 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', 1000000) print len(gen_revs) 500 Package link: https://github.com/mahmoud/wapiti 回答1: If you need more than 500 revision entries you will have to use MediaWiki API with action query , property revisions and parameter rvcontinue , which is taken from the previous

How to get a short snippet of text and the main image of Wikipedia articles by API?

独自空忆成欢 提交于 2019-11-30 14:03:12
问题 I'm trying to create a simple clone of Wikipedia that allows the user to search for a subject, and then display 10 results that contain the article's image and a short snippet of text. I've been able to pass the user supplied search field to my .ajax() call with no problem. But now I'm unable to retrieve the images, I've read all the other posts on StackOverflow regarding this problem, but have no success. $(document).ready(function() { var input = $('input'); var button = $('button'); /

Does the Wikipedia API support searches for a specific template?

限于喜欢 提交于 2019-11-30 08:43:27
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 Template:Persondata . After that, I am hoping to be able to retrieve just that specific template in order to populate genealogy data for the openancestry.org project. The query below shows that the Albert Einstein page contains the Persondata Template, but it doesn't return the contents of the template, and I don't know how to get a list of page