wikipedia

Xcode openURL doesn't read link

China☆狼群 提交于 2019-12-11 17:32:17
问题 I have an animal list and special button. When I press the button, I would like to go to Wikipedia and read about this animal more. So I wrote this code: -(IBAction)goWiki:(id)sender { NSString *wikiUrl = "http://ru.wikipedia.org/wiki/"; NSString *url = [NSString stringWithFormat:@"%@%@",wikiUrl,animalTitle]; [[UIApplication sharedApplication]openURL:[NSURL URLWithString:url]]; NSLog(@"%@",url); } NSLog shows that url was written correctly, however, nothing happened. I am 99,9% sure its

How to check if a person exists on Wikipedia?

安稳与你 提交于 2019-12-11 17:22:52
问题 So I need a function. An example input would be like "donald trump" (I don't want it to be case-sensitive) If an article about the person exists on Wikipedia, function returns a summary and a picture. If not returns false Is this even possible? I couldn't figure out the correct API call. I've tried Wikidata API. It returns multiple objects for some inputs and I didn't know how to redirect it. 回答1: I created simple repo. You can check how it work on GitHub Page. This is search function: $('

Getting Wikipedia Article Summary using NSScanner Problem

时光怂恿深爱的人放手 提交于 2019-12-11 13:29:19
问题 I am trying to get the summary of an article and download it as a string. This works great with some articles, but the wikipedia website is inconsistent. So NSScanner fails pretty often while it works fine for other articles. Here's my NSScanner implementation: NSString *separatorString = @"<table id=\"toc\" class=\"toc\">"; NSScanner *aScanner = nil; NSString *container = nil; NSString *muString = [NSString stringWithString:@"</table>"]; aScanner = [NSScanner scannerWithString:string];

get first paragraph from wikipedia article

China☆狼群 提交于 2019-12-11 13:28:38
问题 I'm using following code to get the first paragraph from a Wikipedia article. Here is the result of my code. I need only this paragraph. Is it possible? Or is there any better alternative? '''Papori''' ({{lang-as|'''?????'''}}) is an [[Assamese language]] feature film directed by [[Jahnu Barua]]. The film stars Gopi Desai, [[Biju Phukan]], Sushil Goswami, Chetana Das and Dulal Roy. The film was released in 1986. Here is my code: #!/usr/bin/python from lxml import etree import urllib from

Extract text from Wikipedia html using Python

亡梦爱人 提交于 2019-12-11 11:34:47
问题 I am trying to look for a way to extract the main text of a Wikipedia article using python. I am aware of the "wikipedia" library, but in my case I already have downloaded the html page, and I just need to extract the text. I can't use that library because I need to use wikipedia page html that was downloaded some years ago so I can't download it from scratch. Is there an "off the shelf" solution that I can use for this purpose? 回答1: try BeautifulSoup : from bs4 import BeautifulSoup import

How to parse the attributes value inside {{}} (curly braces) inside a infobox

﹥>﹥吖頭↗ 提交于 2019-12-11 11:05:08
问题 Within Infobox at wikipedia some attributes values are also inside curly braces {{}}.. Some time they have lins also.. I need values inside the braces, which is displayed on wikipedia web page. I read these are templates also.. Can anyone give me some link or guide me how do I deal with it? 回答1: Double-curly-braces {{}} define a call to some kind of magic word, variable, parser function, or template.. Help can be found on MediaWiki.org/.../Manual:Magic_words. The little lines that look like |

How to get Titles from a Wikipedia Page

淺唱寂寞╮ 提交于 2019-12-11 10:18:49
问题 Is there a direct API call where I can get titles from a wikipedia page. For e.g. from http://en.wikipedia.org/wiki/Chicago, I want to retrieve the following: 1 History 1.1 Rapid growth and development 1.2 20th and 21st centuries 2 Geography 2.1 Topography 2.2 Climate 3 Cityscape 3.1 Architecture so on ----------- I have looked at http://www.mediawiki.org/wiki/API:Lists/All, but couldn't find an action which gives me above list from a wiki page. 回答1: What you want is not a list of pages, so

How would you handle different formats of dates?

喜夏-厌秋 提交于 2019-12-11 09:13:27
问题 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() {

Search for a Wikipedia page based on its NRHP refnum

旧时模样 提交于 2019-12-11 06:26:23
问题 I have an application which maintains a table of places registered in the National Registry of Historic places. I'd like to reliably search for one of these places in Wikipedia, given its NRHP refnum . The search I am currently using now looks like this: http://en.wikipedia.org/w/index.php?title=Special:Search&search=refnum+66000539 (I use Python as my language, but I don't think this is especially relevant here. I construct the url, do a urlfetch , and see what comes back.) But this example,

Wikipedia API - is there a general 'music' category?

怎甘沉沦 提交于 2019-12-11 03:35:32
问题 I have a problem with Wikipedia API. I am using openSearch to get results with links to wikipedia pages. However open search doesn't seem to support +incategory. What is more, I would like to search for music artist (bands, solo singer and all other type of musicians). However I can't find any category named 'music'. The categories are too specific (i.e. 1980s music groups, solo singers etc.). However when you look at disambiguation page of wikipedia for example for offspring you can see this