How to get the link to a wikimedia commons image?

Querying Simple Minds (using: http://musicbrainz.org/ws/2/artist/b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d?inc=url-rels), the following is part of the output:

https://commons.wikimedia.org/wiki/File:The_Fabs.JPG

Iā€™d be interested in getting the URL for the actual image (in this case: https://upload.wikimedia.org/wikipedia/commons/6/6f/Simple_minds_live.jpg) ā€“ the actual metabrainz page for Simple Minds does this anyways (see https://musicbrainz.org/artist/f41490ce-fe39-435d-86c0-ab5ce098b423/relationships).

How do I do this translation (if any), or is there an API call to wikimedia commons in which the target id is used?

Please let me know.

Thanks,
Roy

There is an API call you can make to get a JSON result including the URL to the actual image. I implemented this a while back for the MB artist boxes shown in this forum, see the code at https://github.com/phw/discourse-musicbrainz-onebox/blob/master/engine/wikimedia.rb

And it is also documented somewhere on the Wikipedia pages of course.

2 Likes

MusicBrainz itself uses this URL: https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&iiprop=url&redirects&format=json&iiurlwidth=250&titles=File:The_Fabs.JPG