shafqat | 2 Jul 2009 18:06
Favicon

How can I get the image author (for attribution) via the API


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&prop=images|imageinfo&gimlimit=50&iiprop=url|size|comment&format=xml&iiurlwidth=240&titles=Barack%20Obama

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!
--

-- 
View this message in context: http://www.nabble.com/How-can-I-get-the-image-author-%28for-attribution%29-via-the-API-tp24309511p24309511.html
Sent from the WikiMedia API mailing list archive at Nabble.com.
Roan Kattouw | 2 Jul 2009 19:37
Picon

Re: How can I get the image author (for attribution) via the API

2009/7/2 shafqat <shafqat <at> 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&prop=images|imageinfo&gimlimit=50&iiprop=url|size|comment&format=xml&iiurlwidth=240&titles=Barack%20Obama
>
> 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.jpg&action=edit
. Grab the wikitext of the file description page through
prop=revisions and find the attribution in it.

Roan Kattouw (Catrope)
shafqat | 3 Jul 2009 00:25
Favicon

Re: How can I get the image author (for attribution) via the API


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&action=edit),
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 <at> 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:
>>
(Continue reading)

shafqat | 3 Jul 2009 00:45
Favicon

Re: How can I get the image author (for attribution) via the 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&action=edit)
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=revisions&rvprop=content&gsrnamespace=6&format=xml&gsrsearch=%22Sidney+Crosby%22

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&action=edit),
> there is no 'Author' field. Nor does it appear if I use the prop=revisions
> API parameter.
(Continue reading)

Roan Kattouw | 3 Jul 2009 10:46
Picon

Re: How can I get the image author (for attribution) via the API

2009/7/3 shafqat <shafqat <at> 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&action=edit)
> 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=revisions&rvprop=content&gsrnamespace=6&format=xml&gsrsearch=%22Sidney+Crosby%22
>
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)
Carl (CBM | 10 Jul 2009 21:43
Picon

Breaking change: cmnamespace parameter disabled

The 'cmnamespace' parameter to the 'categorymembers' query has been
disabled in miser mode, which has the effect of disabling it on WMF
wikis. The parameter is simply ignored, causing category lists to
include pages in all namespaces. The simplest workaround is to filter
category lists locally.

References:
* http://www.mediawiki.org/wiki/Special:Code/MediaWiki/53052
* https://bugzilla.wikimedia.org/show_bug.cgi?id=19640

- Carl
Roan Kattouw | 10 Jul 2009 21:53
Picon

[Mediawiki-api-announce] Fwd: Breaking change: cmnamespace parameter disabled

Forwarding to -announce list, sorry about the double-post to mediawiki-api

---------- Forwarded message ----------
From: Carl (CBM) <cbm.wikipedia <at> gmail.com>
Date: 2009/7/10
Subject: [Mediawiki-api] Breaking change: cmnamespace parameter disabled
To: mediawiki-api <at> lists.wikimedia.org

The 'cmnamespace' parameter to the 'categorymembers' query has been
disabled in miser mode, which has the effect of disabling it on WMF
wikis. The parameter is simply ignored, causing category lists to
include pages in all namespaces. The simplest workaround is to filter
category lists locally.

References:
* http://www.mediawiki.org/wiki/Special:Code/MediaWiki/53052
* https://bugzilla.wikimedia.org/show_bug.cgi?id=19640

- Carl

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

_______________________________________________
Mediawiki-api-announce mailing list
Mediawiki-api-announce <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce
(Continue reading)

Alex | 11 Jul 2009 20:07
Picon

Re: Breaking change: cmnamespace parameter disabled

Carl (CBM) wrote:
> The 'cmnamespace' parameter to the 'categorymembers' query has been
> disabled in miser mode, which has the effect of disabling it on WMF
> wikis. The parameter is simply ignored, causing category lists to
> include pages in all namespaces. The simplest workaround is to filter
> category lists locally.
> 
> References:
> * http://www.mediawiki.org/wiki/Special:Code/MediaWiki/53052
> * https://bugzilla.wikimedia.org/show_bug.cgi?id=19640
> 
> - Carl
> 

I committed some changes in r53087 so that it would die with an error if
the option is disabled but someone tries to use it, but the change
hasn't been synced to Wikimedia sites yet.

http://www.mediawiki.org/wiki/Special:Code/MediaWiki/53087

--

-- 
Alex (wikipedia:en:User:Mr.Z-man)
Chad | 11 Jul 2009 20:19
Picon

Re: Breaking change: cmnamespace parameter disabled

I'm not sure if dying is the appropriate response.
Proper documentation & perhaps a warning is
better.

-Chad

On Jul 11, 2009 2:07 PM, "Alex" <mrzmanwiki <at> gmail.com> wrote:

Carl (CBM) wrote: > The 'cmnamespace' parameter to the 'categorymembers' query has been > disabled i...

I committed some changes in r53087 so that it would die with an error if
the option is disabled but someone tries to use it, but the change
hasn't been synced to Wikimedia sites yet.

http://www.mediawiki.org/wiki/Special:Code/MediaWiki/53087

--
Alex (wikipedia:en:User:Mr.Z-man)

_______________________________________________ Mediawiki-api mailing list Mediawiki-api <at> lists.wiki...

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Fabio Junior Sabai | 15 Jul 2009 17:46
Picon

Received message "You need read permission to use this module"

Hi,

I'm using MediaWiki version 1.15.1 and mwlib 0.11.2 and 
Extension:Collection to generate PDF from wiki pages. I set my wiki site 
to prevent anonymous reading and editing and configured Extension::LDAP 
to authenticate through my Active Directory. The Extension:Collection 
has the credentials configured to access MediaWiki API through 
authentication. But when mw-render tries to read pages from my wiki, it 
receives this message "You need read permission to use this module".

I read something about credentials stripping when using JSON callbacks 
(there is a comment in ApiMain.php about this). So, the question is: is 
there a way to mw-render read pages from my wiki even with anonymous 
reading being blocked?

I don't want to allow anonymous access to my pages, but I really need to 
generate PDF's from them.

Thank's for any help.

Best regards,
Fabio Junior Sabai

Gmane