01AutoMonkey
01AutoMonkey

Reputation: 2809

Using the Wikipedia API to get image URLs, but some images don't return an URL, why?

For example going to http://en.wikipedia.org/w/api.php?action=query&titles=Image:Nordendorf-brooch.jpg&prop=imageinfo&iiprop=url&meta=siteinfo&siprop=rightsinfo&format=json&callback=? gives me a JSON object which contains an url key (within "imageinfo") with the value of http://upload.wikimedia.org//wikipedia//commons//c//cc//Nordendorf-brooch.jpg

But some images don't return an url, for example Image:Wodan_Heilt_Balders_Pferd_by_Emil_Doepler.jpg. So if I go to http://en.wikipedia.org/w/api.php?action=query&titles=Image:Wodan_Heilt_Balders_Pferd_by_Emil_Doepler.jpg&prop=imageinfo&iiprop=url&meta=siteinfo&siprop=rightsinfo&format=json&callback=? imageinfo and its url key aren't included in the json object.

One thing I notice apart from imageinfo not being there is that it seems like images that do return an url have the value "shared" in the "imagerepository" key, while those that don't return an url have the value "".

Any ideas why this might be or what the imagerepository key might stand for?

(both images were gotten from http://en.wikipedia.org/wiki/W%C5%8Dden )

Upvotes: 2

Views: 1822

Answers (1)

svick
svick

Reputation: 244757

It seems the problem is that Image:Wodan_Heilt_Balders_Pferd_by_Emil_Doepler.jpg is not the image itself, it's just a redirect to the real image page Image:Wodan_heilt_Balders_Pferd_by_Emil_Doepler.jpg (notice the lowercase h).

If I understand it correctly, if you add &redirects to you query, it should work, but actually doesn't. I think this is a bug, so I submitted a bug report about this.

Upvotes: 4

Related Questions