wikipedia-api

Wikipedia api fulltext search to return articles with title, snippet and image

百般思念 提交于 2019-12-03 04:32:51
问题 I've been looking for a way to query the wikipedia api based on a search string for a list of articles with the following properties: Title Snippet/Description One or more images related to the article. I also have to make the query using jsonp. I've tried using the list=search parameter http://en.wikipedia.org/w/api.php?action=query&list=search&prop=images&format=json&srsearch=test&srnamespace=0&srprop=snippet&srlimit=10&imlimit=1 But it seems to ignore the prop=images, I've also tried

Searching Wikipedia using API

守給你的承諾、 提交于 2019-12-03 03:10:05
问题 I want to search Wikipedia using the query action. I am using this url: http://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch=apple That works but I want to get into the first result of the search. How can I do that? Note: That url works fine when there is only one result.. I just need the title and some short description. 回答1: I don't think you can do both in one query. 1. To get the first result, use the Opensearch API. https://en.wikipedia.org/w/api.php?action

How to download images programatically from Wikimedia Commons without registering for a Bot account?

主宰稳场 提交于 2019-12-03 02:00:32
It seems like the only way to get approval for a Bot account is if it adds to or edits information already on Wikimedia. If you try to download any images, without a bot account, using some of the api libraries out there you get error messages instead of the images. Seems like they block anyone not coming in from a browser? Anyone else have any experience with this? Am I missing something here? Try explaining exactly what you want to do? And what you've tried? What error message did you get? You're not very clear... What libraries have you tried? If you're not aggressive, there are no

How to extract data from a Wikipedia article?

∥☆過路亽.° 提交于 2019-12-02 21:20:27
I have a question regarding parsing data from Wikipedia for my Android app. I have a script that can download the XML by reading the source from http://en.wikipedia.org/w/api.php?action=parse&prop=text&format=xml&page=ARTICLE_NAME (and also the JSON by replacing format=xml with format=json . But what I can't figure out is how to only access certain sections from the table of contents. What I want is when the page is loaded, the user can press a button that makes a pop-up appear that displays the headers from the table of contents and allow the user to read that piece and only that piece of it

Wikipedia api fulltext search to return articles with title, snippet and image

只愿长相守 提交于 2019-12-02 17:44:22
I've been looking for a way to query the wikipedia api based on a search string for a list of articles with the following properties: Title Snippet/Description One or more images related to the article. I also have to make the query using jsonp. I've tried using the list=search parameter http://en.wikipedia.org/w/api.php?action=query&list=search&prop=images&format=json&srsearch=test&srnamespace=0&srprop=snippet&srlimit=10&imlimit=1 But it seems to ignore the prop=images, I've also tried variations using the prop=imageinfo and prop=pageimages. But they all give me the same result as just using

Searching Wikipedia using API

牧云@^-^@ 提交于 2019-12-02 16:40:29
I want to search Wikipedia using the query action. I am using this url: http://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch=apple That works but I want to get into the first result of the search. How can I do that? Note: That url works fine when there is only one result.. I just need the title and some short description. octosquidopus I don't think you can do both in one query. 1. To get the first result, use the Opensearch API . https://en.wikipedia.org/w/api.php?action=opensearch&search=zyz&limit=1&namespace=0&format=jsonfm https://en.wikipedia.org/w/api.php

Getting content using wikipedia API

南笙酒味 提交于 2019-12-02 09:16:27
How can I get the entire first section/paragraph of a Wikipedia article including the first image with a single request? What I've tried so far (the following url) returns only a snippet: http://en.wikipedia.org/w/api.php?format=xml&action=query&list=search&srsearch=camera&srlimit=1 If you're wanting the wikitext, use prop=revisions with rvsection=0 . If you're wanting HTML, you can add rvparse=1 to that query or you can use action=parse . How can I get the entire first section/paragraph of a Wikipedia article including the first image with a single request? It's not possible to do that in one

Cannot fetch data from Wikipedia API

眉间皱痕 提交于 2019-12-01 13:08:11
let dataObj = []; const query = 'marvel'; fetch(`https://en.wikipedia.org/w/api.php?action=query&titles=${query}&prop=revisions&rvprop=content&format=json&formatversion=2`) .then(data => data.json()) .then(data => dataObj.push(data)) .catch(err => console.log(err)); This is the error that I receive: No ' Access-Control-Allow-Origin ' header is present on the requested resource. Origin ' https://s.codepen.io ' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to ' no-cors ' to fetch the resource with CORS disabled. I set the mode to no-cors but

How to form dbPedia iSPARQL query (for wikipedia content)

最后都变了- 提交于 2019-12-01 13:02:39
Say I need to fetch content from wikipedia about all mountains. My target is to show initial paragraph, and an image from respective article (eg. Monte Rosa and Vincent Pyramid . I came to know about dbpedia, and with some research got to find that it provides live queries into wiki database directly. I have 2 questions: 1 - I am finding it difficult how could I formulate my queries. I can't play around iSPARQL . I tried following query but it throws error saying invalid xml. SELECT DISTINCT ?Mountain FROM <http://dbpedia.org> WHERE { [] rdf:type ?Mountain } 2 - My requirement is to show only

How to form dbPedia iSPARQL query (for wikipedia content)

你。 提交于 2019-12-01 10:41:09
问题 Say I need to fetch content from wikipedia about all mountains. My target is to show initial paragraph, and an image from respective article (eg. Monte Rosa and Vincent Pyramid. I came to know about dbpedia, and with some research got to find that it provides live queries into wiki database directly. I have 2 questions: 1 - I am finding it difficult how could I formulate my queries. I can't play around iSPARQL. I tried following query but it throws error saying invalid xml. SELECT DISTINCT