Thank you. I will make use of that over the weekend to download some of the WLM images for
the jury to review.
Regards
Michael
On 18 Oct 2013, at 17:48, Fæ wrote:
On 18/10/2013, Michael Maggs
<Michael(a)maggs.name> wrote:
So far as I can see, getting the file via the API
requires knowledge of the
URL, which itself means calculating an md5 hash on the image name. In
Applescript, this seems to work, so long as there are no odd characters, but
No need for md5 hash calculations :-)
In python the call to fileUrl() actually 'translates' the Commons
image page name into the URL for the full size image file to download
without having to provide any other information. Behind the scenes
this actually uses the API to call a "query" returning "imageinfo".
You may find a real example of API calls useful. Starting with the
image title "Gay.jpg" [1] we can ask the API to tell us its properties
by creating a call to API query [2], within the results (which you
could ask for as xml or JSON) this returns us the URL link to the full
sized image file which you can download. [3]
Rather than full size, you can request a particular size, such as with
a width of 100px [4]. In my script to query
tineye.com to check for
matches to mobile images as possible copyright violations, I only used
thumbnails of width 300px, it saved a lot of bandwidth. :-)
1.
http://commons.wikimedia.org/wiki/File:Gay.jpg
2.
https://commons.wikimedia.org/w/api.php?action=query&titles=File:Gay.jp…
3.
https://upload.wikimedia.org/wikipedia/commons/9/90/Gay.jpg
4.
https://commons.wikimedia.org/w/api.php?action=query&titles=File:Gay.jp…
I would imagine that an introductory workshop should cover the basics
of how to use the API and how to find parameters in the manual, this
would be particularly useful for folks more comfortable programming in
other languages that Python, or using other tools, and would still use
all the features of the API to do interesting stuff.
Fae
--
faewik(a)gmail.com
http://j.mp/faewm