Is it possible to download images from Wikipedia with MediaWiki API?
No, it is not possible to get the images via the API. Images in a MediaWiki are stored just in folders, not in a database and are not delivered dynamically (more information on that in the Manual:Image administration).
However, you can retrieve the URLs of those image files via the API. For example see the API:Allimages list or imageinfo property querymodules. Then you can download the files from those URLs with your favourite tool (curl
, wget
, whatever).
If your question is about downloading all images from Wikipedia, meta:data dumps would be a good start. You also may ask on the data-dump mailing list on how to sync with a repository like Wikimedia Commons.
Given you know the file's name, no need for the API. This works:
# Curl download, -L: follow redirect, -C -: resume downloads, -O: keep filename
curl -L -C - -O http://commons.wikimedia.org/wiki/Special:FilePath/Example.jpg # Example.jpg
© 2022 - 2024 — McMap. All rights reserved.