Hoi, Does anyone have a script that will give the Wikidata ID when a Wikipedia article name is given ?
The script should be preferably in PHP. Thanks, Gerard
Hey,
$store = Wikibase\StoreFactory::getStore(); $numericId = $store->newSiteLinkCache()->getItemIdForLink( $globalSiteId, $pageTitle );
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. --
Someone mentioned https://github.com/Tpt/wikibase-api-php in #wikimedia-wikidata a while back. -- Legoktm
On Mon, Feb 18, 2013 at 12:11 PM, Gerard Meijssen <gerard.meijssen@gmail.com
wrote:
Hoi, Does anyone have a script that will give the Wikidata ID when a Wikipedia article name is given ?
The script should be preferably in PHP. Thanks, Gerard
Wikidata-l mailing list Wikidata-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-l
On 18.02.2013 19:11, Gerard Meijssen wrote:
Hoi, Does anyone have a script that will give the Wikidata ID when a Wikipedia article name is given ?
The simplest way by far is Special:ItemByTitle:
https://www.wikidata.org/wiki/Special:ItemByTitle/enwiki/Wau_Holland
will redirect to
https://www.wikidata.org/wiki/Q72250
which references
https://en.wikipedia.org/wiki/Wau_Holland
Alternatively, you can use the API:
https://wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&tit...
Note that "title" in the output is the item ID (which is also the title of the wikidata page).
hth -- daniel