Search code examples
pythonwikipediawikidatapywikibot

How to find out the name of an item having the wikidata code Q89 =>(apple)


How to find out the name of an item having the wikidata code Q89 (apple) , for properties I made a dictionary,but for item code I can't find anithing , I am using pywikibot for other operations , it is there any function do that?


Solution

  • You can use Wikidata API to get a JSON representation of the entity, including its labels: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q89&format=json&props=labels

    Or, from the command-line, you can use a tool such as (the one I wrote ;)) Wikidata CLI: wd label Q89