I have spent a lot of time in the forum and now have a working query that gets me all the information I need (a list of images plus other info). However, I need to also get the image author so that I can have the proper attribution. Have tried everything but cannot get that piece of data. Am I missing something?
This is the query that I am using to get the images:
http://commons.wikimedia.org/w/api.php?action=query&generator=images&...
As an example, for this file http://commons.wikimedia.org/wiki/File:BarackObama2005portrait.jpg, I would want to get back the text "United States Senate", which is listed right next to the Author field.
Thanks a lot!
2009/7/2 shafqat shafqat@newscred.com:
I have spent a lot of time in the forum and now have a working query that gets me all the information I need (a list of images plus other info). However, I need to also get the image author so that I can have the proper attribution. Have tried everything but cannot get that piece of data. Am I missing something?
This is the query that I am using to get the images:
http://commons.wikimedia.org/w/api.php?action=query&generator=images&...
As an example, for this file http://commons.wikimedia.org/wiki/File:BarackObama2005portrait.jpg, I would want to get back the text "United States Senate", which is listed right next to the Author field.
It's right there in the wikitext: http://commons.wikimedia.org/w/index.php?title=File:BarackObama2005portrait.... . Grab the wikitext of the file description page through prop=revisions and find the attribution in it.
Roan Kattouw (Catrope)
That is a good suggestion, and using the wikitext via the prop=revisions parameter worked for the example given before. However, it does not always work and I was wondering if there is a consistent rule or way to get this info.
For example, for this image page (http://commons.wikimedia.org/wiki/Image:Sidney_Crosby.jpg), I can see the 'Author' field on screen. But in the wikitext here (http://commons.wikimedia.org/w/index.php?title=File:Sidney_Crosby.jpg&ac...), there is no 'Author' field. Nor does it appear if I use the prop=revisions API parameter.
Is there no consistent rule to get the author for images? Sorry if I am missing something obvious but I'm fairly new to this.
Roan Kattouw-2 wrote:
2009/7/2 shafqat shafqat@newscred.com:
I have spent a lot of time in the forum and now have a working query that gets me all the information I need (a list of images plus other info). However, I need to also get the image author so that I can have the proper attribution. Have tried everything but cannot get that piece of data. Am I missing something?
This is the query that I am using to get the images:
http://commons.wikimedia.org/w/api.php?action=query&generator=images&...
As an example, for this file http://commons.wikimedia.org/wiki/File:BarackObama2005portrait.jpg, I would want to get back the text "United States Senate", which is listed right next to the Author field.
It's right there in the wikitext: http://commons.wikimedia.org/w/index.php?title=File:BarackObama2005portrait.... . Grab the wikitext of the file description page through prop=revisions and find the attribution in it.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
I should clarify since I now realize that the wikitext on the page (http://commons.wikimedia.org/w/index.php?title=File:Sidney_Crosby.jpg&ac...) contains attribution info in the Flickr template, which is good enough. However, I can't seem to get this info when using the prop=revisions query I've been using and works most of the time.
http://en.wikipedia.org/w/api.php?action=query&generator=search&prop...
Notice the first few images have no revisions returned, while the last three have revisions returned. If I go straight to the image file and try prop=revisions, I get the info back. What am I doing wrong with my query above that's causing some images to return revision wikitext, while others to not return it?
Thanks.
shafqat wrote:
That is a good suggestion, and using the wikitext via the prop=revisions parameter worked for the example given before. However, it does not always work and I was wondering if there is a consistent rule or way to get this info.
For example, for this image page (http://commons.wikimedia.org/wiki/Image:Sidney_Crosby.jpg), I can see the 'Author' field on screen. But in the wikitext here (http://commons.wikimedia.org/w/index.php?title=File:Sidney_Crosby.jpg&ac...), there is no 'Author' field. Nor does it appear if I use the prop=revisions API parameter.
Is there no consistent rule to get the author for images? Sorry if I am missing something obvious but I'm fairly new to this.
Roan Kattouw-2 wrote:
2009/7/2 shafqat shafqat@newscred.com:
I have spent a lot of time in the forum and now have a working query that gets me all the information I need (a list of images plus other info). However, I need to also get the image author so that I can have the proper attribution. Have tried everything but cannot get that piece of data. Am I missing something?
This is the query that I am using to get the images:
http://commons.wikimedia.org/w/api.php?action=query&generator=images&...
As an example, for this file http://commons.wikimedia.org/wiki/File:BarackObama2005portrait.jpg, I would want to get back the text "United States Senate", which is listed right next to the Author field.
It's right there in the wikitext: http://commons.wikimedia.org/w/index.php?title=File:BarackObama2005portrait.... . Grab the wikitext of the file description page through prop=revisions and find the attribution in it.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
2009/7/3 shafqat shafqat@newscred.com:
I should clarify since I now realize that the wikitext on the page (http://commons.wikimedia.org/w/index.php?title=File:Sidney_Crosby.jpg&ac...) contains attribution info in the Flickr template, which is good enough. However, I can't seem to get this info when using the prop=revisions query I've been using and works most of the time.
http://en.wikipedia.org/w/api.php?action=query&generator=search&prop...
This is because you're grabbing them from enwiki, while the image description page is really on Commons. The UI shows the description page transparently, but the API doesn't. You'll have to run the query on Commons to get the info in this case.
Roan Kattouw (Catrope)
mediawiki-api@lists.wikimedia.org