With the following code it is possible to extract data from entities in Wikidata:
import requests
API_ENDPOINT = "https://www.wikidata.org/w/api.php"
query = "wikipedia"
params = {
'action': 'wbsearchentities',
'format': 'json',
'language': 'en',
'search': query
}
r = requests.get(API_ENDPOINT, params = params)
print(r.json()['search'][0])
and the output is:
{'repository': '', 'id': 'Q52', 'concepturi': 'http://www.wikidata.org/entity/Q52', 'title': 'Q52', 'pageid': 170, 'url': '//www.wikidata.org/wiki/Q52', 'label': 'Wikipedia', 'description': 'free online encyclopedia that anyone can edit', 'match': {'type': 'label', 'language': 'en', 'text': 'Wikipedia'}}
But going to the concepturi 'http://www.wikidata.org/entity/Q52 I see more information than reported here in the json file, specifically I am interested on motto text field.
How could I get more information from Wikidata? (this is an example more could be shown where the query outputs less info than contained in Wikidata).