Request Wikipedia Pages with Properties

I need to use Query Wikipedia Query or any other api like Opensearch to request a simple list of pages with some properties.

Input: a list of pages (articles) or identifiers.
Conclusion: a list of pages, each of which contains the following properties:
page id
name
fragment / description (for example, in the opensearch api)
page
url image url (as in the opensearch api)

The result is similar to this:
http://en.wikipedia.org/w/api.php?action=opensearch&search=miles%20davis&limit=20&format=xml
Only with page IDs, not with search, but with an exact list of pages by title or page.

This should be a pretty simple thing, but I've been stuck with this for quite some time, having tried all kinds of URL combinations from the MW api manual without success.

+5
source share
2 answers

I don’t think there is another way than the Open Search API to extract Open Search data, but depending on which Wikipedia you are interested in, other extensions can be installed inside to help you. As an example, take the English Wikipedia, we can use MobileFrontend and PageImages , what happens with there .

  • URL API MediaWiki. URL-, prop=info inprop=url, .
  • prop=pageimages, PageImages.
  • MobileFrontend extracts, exintro, . , MediWiki , . , :

http://en.wikipedia.org/w/api.php?action=query&pageids=21482&prop=pageimages|info|extracts&inprop=url&exintro

:

<api>
  <query>
    <pages>
      <page pageid="21482" ns="0" title="Nairobi" pageimage="Nairobi_Montage.jpg" contentmodel="wikitext" pagelanguage="en" touched="2014-02-06T06:10:01Z" lastrevid="594161616" counter="" length="89157" fullurl="http://en.wikipedia.org/wiki/Nairobi" editurl="http://en.wikipedia.org/w/index.php?title=Nairobi&amp;action=edit">
        <thumbnail source="http://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Nairobi_Montage.jpg/45px-Nairobi_Montage.jpg" width="45" height="50" />
        <extract xml:space="preserve">
             &lt;p&gt;&lt;b&gt;Nairobi&lt;/b&gt; /naɪˈroʊbi/ is the [...]
        </extract>
      </page>
    </pages>
  </query>
</api>
+2

, URL-.

: : " URL- API MediaWiki. URL-, prop = info inprop = url, url, .

API , JSON, URL:
https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=REPLACE_ME_WITH_SEARCH_TOPIC&format=json&callback=?

, "format = json & callback =?" "formatversion = 2", , :
https: //en.wikipedia.org/w/api.php?action=query&list=search&srsearch=REPLACE_ME_WITH_SEARCH_TOPIC&formatversion=2

/ "" JSON, , URL- .
URL- 1:
https: //en.wikipedia.org/w/api.php?action=query&list=search&srsearch=thailand&format=json&callback=?

1 , JSON, 2, , 1, API ( ) URL- JSON... 2.

JSON 1:

URL- 2:
https: //en.wikipedia.org/w/api.php?action=query&titles=Thailand|Outline%20of%20Thailand|Geography%20of%20Thailand|Economy%20of%20Thailand|Football%20in%20Thailand|Southern%20Thailand|Government%20of%20Thailand|Northern%20Thailand|Culture%20of%20Thailand|Cinema%20of%20Thailand&prop=info&inprop=url&format=json&callback=?

0

All Articles