Given a Wikimedia Commons description page URL - such as:
https://commons.wikimedia.org/wiki/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg

I would like to be able to programmatically retrieve the information in the
"Summary" header.  (Values for "Artist", "Title", "Date", "Medium",
"Dimensions", "Current location", etc.)

I believe all this information is in "Template:Artwork".  I can't figure
out how to get the wikitext/json-looking template data.

If I use the API and call:
https://commons.wikimedia.org/w/api.php?action=query&format=xml&titles=File:Van%20Gogh%20-%20Starry%20Night%20-%20Google%20Art%20Project.jpg&iilimit=max&iiprop=timestamp|user|comment|url|size|mime&prop=imageinfo|revisions&rvgeneratexml=&rvprop=ids|timestamp|user|comment|content

Then I don't get the information I'm looking for.  This shows the most
recent revision, and its changes.  Unless the most recent revision changed
this data, it doesn't show up.

To see all the information I'm looking for, it seems I'd have to specify
rvlimit=max and go through all the past revisions to figure out which is
most current.  For example, if I do so and I look at revid 79665032, that
includes: "{{Artwork | Artist = {{Creator:Vincent van Gogh}} | . . . | Year
= 1889 | Technique = {{Oil on canvas}} | . . ."

Isn't there a way to get the current version in whatever format you'd call
that - the wikitext/json looking format?

In my API call, I can specify rvexpandtemplates which even with only the
most recent revision gives me the information I need, but it's largely in
HTML tables/divs/etc format rather than wikitext/json/xml/etc.
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to