wikipedia-api

How would you handle different formats of dates?

▼魔方 西西 提交于 2019-11-30 06:05:15
问题 I have different types of dates formatting like: 27 - 28 August 663 CE 22 August 1945 19 May May 4 1945 – August 22 1945 5/4/1945 2-7-1232 03-4-1020 1/3/1 (year 1) 09/08/0 (year 0) Note they are all different formats, different order, some have 2 months, some only one, I tried to use moment js with no results, I also tried to use date js yet, no luck. I tried to do some splitting: dates.push({ Time : [] }); function doSelect(text) { return $wikiDOM.find(".infobox th").filter(function() {

Get first lines of Wikipedia Article

佐手、 提交于 2019-11-30 05:16:38
I got a Wikipedia-Article and I want to fetch the first z lines (or the first x chars, or the first y words, doesn't matter) from the article. The problem: I can get either the source Wiki-Text (via API) or the parsed HTML (via direct HTTP-Request, eventually on the print-version) but how can I find the first lines displayed? Normaly the source (both html and wikitext) starts with the info-boxes and images and the first real text to display is somewhere down in the code. For example: Albert Einstein on Wikipedia (print Version). Look in the code, the first real-text-line "Albert Einstein

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

半世苍凉 提交于 2019-11-30 05:13:29
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 term ex. i search for Matrix, category movies, so i can have The Matrix 1 The Matrix 2 etc excluding math results etc... thanks I feel your pain bro, try something like: http://en.wikipedia.org/w/api.php?action=query&list=search&format=jsonfm&srsearch=matrix+incategory:English-language_films Change the above format from jsonfm to json for real json

RegEx needed for Wikipedia infobox

爷,独闯天下 提交于 2019-11-29 22:17:28
问题 OK, so here's what I need : We have the full XML of a Wikipedia article We need just the Infobox section I have tried various things, but my main issue seems to be not being able to matching "internal" curly brackets. Any ideas (or any regex you have managed to get this done?) For those of you who do not know what I'm talking about, here's a (somewhat abridged) example of what I'm trying to parse : http://regexr.com?38299 (What is needed is the part between {{Infobox ******* up to its

How to get plain text out of wikipedia

梦想的初衷 提交于 2019-11-29 21:02:15
I've been searching for about 2 months now to find a script that gets the Wikipedia description section only. (It's for a bot i'm building, not for IRC.) That is, when I say /wiki bla bla bla it will go to the Wikipedia page for bla bla bla , get the following, and return it to the chatroom: "Bla Bla Bla" is the name of a song made by Gigi D'Agostino. He described this song as "a piece I wrote thinking of all the people who talk and talk without saying anything". The prominent but nonsensical vocal samples are taken from UK band Stretch's song "Why Did You Do It" Here is the closest I've found

How to get information in info box of Wikipedia articles using Wikipedia api?

試著忘記壹切 提交于 2019-11-29 17:59:05
I'm trying to get lead actor's name from movie's Wikipedia article. I tried different values for prop, prop=info seems most relevant. But this doesn't contain the information in info box of Wikipedia article. See: http://en.wikipedia.org/w/api.php?action=query&prop=info&titles=Casino_Royale_(2006_film)&format=jsonfm Is it possible to extract information in infobox using Wikipedia API? svick The MediaWiki API doesn't understand infoboxes. So, you have basically two options: Parse the infobox yourself. You can either parse the wikitext directly or the generated HTML table (both are available

android Wikipedia api game

大兔子大兔子 提交于 2019-11-29 13:11:18
Hi i have to make an app with the following requirement: When the user opens the app, it displays the text from a random Wikipedia page. (You’re free to use any logic for grabbing text from a random Wiki page(preferably using REST APIs)) The game requires a minimum of 10 lines of text on the screen. However, we want to show complete paragraphs of text to make it easier to understand the content displayed. Use the least number of paragraphs required to cross the 10 sentence limit. I am able to get text from random wiki page but many times text is less than 10 sentences and to ensure minimum 10

Does the Wikipedia API support searches for a specific template?

五迷三道 提交于 2019-11-29 12:17:02
问题 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

How to access Wikipedia from R?

♀尐吖头ヾ 提交于 2019-11-29 03:16:29
问题 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? 回答1: Use the RCurl package for retreiving info, and the XML or RJSONIO packages for parsing the response. If you are behind a proxy, set your options. opts <- list( proxy = "136.233.91.120", proxyusername = "mydomain\\myusername", proxypassword = 'whatever', proxyport = 8080 ) Use the

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

て烟熏妆下的殇ゞ 提交于 2019-11-29 03:06:32
问题 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 term ex. i search for Matrix, category movies, so i can have The Matrix 1 The Matrix 2 etc excluding math results etc... thanks 回答1: I feel your pain bro, try something like: http://en.wikipedia.org/w/api.php?action=query&list=search&format=jsonfm