wikipedia

requests.history not showing all redirects

夙愿已清 提交于 2019-12-04 06:32:16
问题 I'm trying to get the redirects of some Wikipedia pages, and it's happening something curious to me. If i make: >>> request = requests.get("https://en.wikipedia.org/wiki/barcelona", allow_redirects=True) >>> request.url u'https://en.wikipedia.org/wiki/Barcelona' >>> request.history [<Response [301]>] As you can see, the redirection is correct and I have same url in browser that in Python. But if I try: >>> request = requests.get("https://en.wikipedia.org/wiki/Yardymli_Rayon", allow_redirects

TripleDES key sizes - .NET vs Wikipedia

こ雲淡風輕ζ 提交于 2019-12-04 06:04:00
According to Wikipedia , TripleDES supports 56, 112, and 168-bit key lengths, but the System.Cryptography.TripleDESCryptoServiceProvider.LegalKeySizes says it only accepts 128 and 192-bit key lengths. The system I'm developing needs to be interoperable (data encrypted by my code needs to be decryptable in PHP, Java, and Objective-C) and I don't who is correct in this case. So who should I believe? And how can I be sure my encrypted data is portable? Wikipedia does not say TripleDES supports 56 bit keys. The "keying options" talk about "triple-length" keys and "double-length" keys, the latter

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':

Auto-hyperlink every occurence of a certain word (or word sequence) to predefined URL (non-ambiguous); but not show full URL

こ雲淡風輕ζ 提交于 2019-12-03 22:14:07
Similar to: Search For Words, Replace With Links . However, I would rather not have the full hyperlink's URL visible, but instead have only the appearance of a hyperlink visible to the end-user. --- I also can't figure out how to use the replace() -JS-function, like used in the following post: How to replace all occurrences of a string in JavaScript? , for this same specific issue. --- Also similar to a JS-question: Link terms on page to Wikipedia articles in pure JavaScript , but I guess the answer given there can not, up front, differentiate between ambiguous terms. How to auto-link every

MYSQL Huge SQL Files Insertion | MyISAM speed suddenly slow down for Insertions (strange issue)

人走茶凉 提交于 2019-12-03 21:55:20
I'm facing very strange problem, I've asked the question here about speed up the insertion in MYSql, especially about the insertion of Huge SQL files multiple GB in size. They suggested me to use MyISAM engine. I did the following: ALTER TABLE revision ENGINE=MyISAM; Use ALTER TABLE .. DISABLE KEYS . (MyISAM only) Set bulk_insert_buffer_size to 500M. (MyISAM only) Set unique_checks = 0 . not checked. SET autocommit=0; ... SQL import statements ... COMMIT; SET foreign_key_checks=0; It Speed up the process to 5 minutes that previously took 2 hours and I'm impressed. But now when i tried the same

How to get the Image from first page when search in Google?

你。 提交于 2019-12-03 21:22:30
Usually after using Google to search for a city, there is a part of Wikipedia page on the right with an image and a map. Can anyone tell me how I could access this image? I should know how to download it. Actually the main image (that goes with the map image on the right) is very rarely from Wikipedia, so you can't use Wikipedia API to get it. If you want to access the actual main image you can use this: private static void GetGoogleImage(string word) { // make an HTTP Get request var request = (HttpWebRequest)WebRequest.Create("https://www.google.com.pg/search?q=" + word); request.UserAgent =

MYSQL Insert Huge SQL Files of GB in Size

耗尽温柔 提交于 2019-12-03 21:01:54
I'm trying to create a Wikipedia DB copy (Around 50GB), but having problems with the largest SQL files. I've split the files of size in GB using linux split utility into chunks of 300 MB. e.g. split -d -l 50 ../enwiki-20070908-page page.input. On average 300MB files take 3 hours at my server. I've ubuntu 12.04 server OS and Mysql 5.5 Server. I'm trying like following: mysql -u username -ppassword database < category.sql Note: these files consist of Insert statements and these are not CSV files. Wikipedia offers database dumps for download, so everybody can create a copy of Wikipedia. You can

Getting Wikipedia infobox content with JQuery

∥☆過路亽.° 提交于 2019-12-03 14:48:36
I'm looking to use JQuery to pull back contents of the Wikipedia infobox that contains company details. I think that I'm almost there but I just can't get the last step of the way var searchTerm="toyota"; var url="http://en.wikipedia.org/w/api.php?action=parse&format=json&page=" + searchTerm+"&redirects&prop=text&callback=?"; $.getJSON(url,function(data){ wikiHTML = data.parse.text["*"]; $wikiDOM = $(wikiHTML); $("#result").append($wikiDOM.find('.infobox').html()); }); The first part works - wikiHTML contains the content of the page, parsed by the Wikipedia API to HTML format This contains the

Retrieving the Interlanguage links from an exported Wikipedia article?

懵懂的女人 提交于 2019-12-03 14:12:48
I used to retrieve the interlanguage links from an exported Wikipedia article by parsing the export with some regular expressions. In phase 1 of the WikiData project these links have been moved to a separate page on Wikidata. For example the article Ore Mountains has no language links anymore in the export. The language links are now on Q4198 . How can I export the language links? You are now encouraged to use the Wikidata aPI : http://wikidata.org/w/api.php For your case, use props=labels . This url is self explicative : http://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki

How do I get link to an image on wikipedia from the infobox?

橙三吉。 提交于 2019-12-03 13:44:27
问题 I'm parsing wikipedia infoboxes and I noticed that some infoboxes have image fields - these fields hold names of image files stashed on wikipedia somewhere. However they just contain the name of the file as is as opposed to the actual link. I checked the links of the images on real live infoboxes and the links do not seem to be from one source but the sources vary. How can I hyperlink to an image on wikipedia considering I only have the name of the image from an infobox entry. 回答1: Have you