2

I need just to retrieve image inside a Wikipedia page with a specific size, and image may have description plus width and height.

Update:

I am asking about retrieve All images inside wikipedia article Not wikipedia article main images!.

Khaled Lela
  • 7,831
  • 6
  • 45
  • 73
  • possible duplicate of [Accessing main picture of wikipedia page by API](http://stackoverflow.com/questions/8363531/accessing-main-picture-of-wikipedia-page-by-api) – leo Apr 16 '15 at 09:26
  • Yes there is. See http://stackoverflow.com/questions/8363531/accessing-main-picture-of-wikipedia-page-by-api and multiple other questions – leo Apr 16 '15 at 09:27
  • I am asking about retrieve All images inside wikipedia article Not wikipedia article main images!. – Khaled Lela Apr 16 '15 at 10:06

1 Answers1

3

To retrieve all images from a MediaWiki article, query for the images property:

http://en.wikipedia.org/w/api.php?action=query&prop=images&titles=Main%20Page

Then you can ask for paths to specific sizes:

https://en.wikipedia.org/w/api.php?action=query&titles=File:Bubolz%20Grass.jpg&prop=imageinfo&&iiprop=url&iiurlwidth=220

Finally, you can use the first query as a generator for the second, to get all the data in one request:

https://en.wikipedia.org/w/api.php?action=query&generator=images&titles=Albert%20Einstein&prop=imageinfo&&iiprop=url&iiurlwidth=220

Note that this is part of the MediaWiki core API, and not specific to Wikipedia or even the Wikimedia universe.

leo
  • 8,106
  • 7
  • 48
  • 80
  • Can i get images with info in one connection! – Khaled Lela Apr 16 '15 at 11:38
  • 2
    Yes, please read the documentation on generators I linked to. You can use the first guery as a generator for the second! – leo Apr 16 '15 at 11:50
  • Thank you for your help. [Albert Einstein Images](https://en.wikipedia.org/w/api.php?action=query&generator=images&titles=Albert%20Einstein&prop=imageinfo&&iiprop=url&iiurlwidth=220) – Khaled Lela Apr 16 '15 at 12:18