Platonides,

Thank you, that's really interesting.

Tim

On Thu, Mar 8, 2012 at 6:36 PM, Platonides <platonides@gmail.com> wrote:
On 08/03/12 03:09, Timothy Helck wrote:
> Gentlemen,
>
> Thanks for your previous suggestions.Unfortunately I've been busy with
> other things and I am just getting back to this.
>
> I think I have found a reasonable strategy for searching images. I can
> use this query (siilar to what was suggested by Platonides):
> https://commons.wikimedia.org/w/api.php?action=query&list=search&srnamespace=6&srsearch=%22chartres+cathedral%22&srlimit=20&sroffset=20&prop=imageinfo
>
> Then I can parse the result set and create another query which gets me
> the urls:
> https://commons.wikimedia.org/w/api.php?action=query&titles=File:Chartres%20cathedral%202881.jpg|File:Chartres%20cathedral%202880.jpg|File:Chartres%20cathedral%202879.jpg&prop=imageinfo&iiprop=url

No need to perform two requests. The MediaWiki API generators can
combine them for you:
 https://commons.wikimedia.org/w/api.php?action=query&generator=search&gsrnamespace=6&gsrsearch=%22chartres+cathedral%22&gsrlimit=20&gsroffset=20&prop=imageinfo&iiprop=url



> However, I am still encountering a problem -- commons.wikimedia.org
> <http://commons.wikimedia.org> doesn't like requests that don't come
> from a browser. When I put these queries into php I get a 403 error. Is
> there a url where I can search wikimedia programatically?
>
> regards,
>
> Tim

You need to use an User-Agent which identifies your tool.

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