Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get image URL in wiki api?

When I call wiki APIs for accessing image URLs, I get image URLs like this,

File:Ad-tech London 2010 (2).JPG

How to get the correct URL of this file from wiki API?

like image 536
Anu Avatar asked Jun 11 '15 12:06

Anu


People also ask

How do I get an image from Wikipedia API?

As other's have mentioned, you would use prop=pageimages in your API query. If you also want the image description, you would use prop=pageimages|pageterms instead in your API query. You can get the original image using piprop=original . Or you can get a thumbnail image with a specified width/height.

How do I link an image in Wikipedia?

Upload an image that you own now. You can log in there using your same Wikipedia user name and password. Click the "upload file" link in the menu to the left. Follow the instructions to upload the file. It's the same procedure as most websites, although we only accept "freely licensed" images.

Does Wiki have an API?

What is the Wikipedia API? The Wikipedia API (official documentation) is supported by the MediaWiki's API and provide access to Wikipedia and other MediaWiki data without interacting with the user interface.

How do I get a content page on Wikipedia?

There are three main methods for retrieving page content via the API: Get the contents of a page using the Revisions API (as wikitext). Get the contents of a page using the Parse API (as HTML or wikitext). Get plain text or limited HTML extracts of a page using the API of the TextExtracts extension.


1 Answers

There's little documentation on image/thumbnail URLs besides T153497. You can use Special:FilePath and/or thumb.php:

  • https://commons.wikimedia.org/wiki/Special:FilePath/Ad-tech_London_2010_(2).JPG
  • https://commons.wikimedia.org/wiki/Special:FilePath/Ad-tech_London_2010_(2).JPG?width=200 (to get a thumbnail of 200px width)
  • https://commons.wikimedia.org/w/thumb.php?f=Ad-tech_London_2010_(2).JPG&w=200
like image 176
simon04 Avatar answered Sep 16 '22 15:09

simon04