On 2018-01-26 09:16, Victor Shepelev wrote:
Is there a way to tell actually non-existent files from files that are included from commons, through API? Or "just check on commons, in case it is there" is the only way?

You can add &prop=imageinfo to the query:

Files that are loaded from Commons will have the property `"imagerepository": "shared"`:
https://en.wikipedia.org/w/api.php?action=query&titles=File:Logo_of_the_Verkhovna_Rada_of_Ukraine.svg&prop=imageinfo

Files that are uploaded locally will have `"imagerepository": "local"`:
https://en.wikipedia.org/w/api.php?action=query&titles=File:Example.jpg&prop=imageinfo

Files that are actually missing will have `"imagerepository": ""`:
https://en.wikipedia.org/w/api.php?action=query&titles=File:Does%20not%20exist%20blahblahblah.svg&prop=imageinfo

prop=imageinfo also provides some other information about the files, if you add additional options. See https://www.mediawiki.org/wiki/API:Imageinfo .


--
Bartosz Dziewoński

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

Reply via email to