1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "sparql": """SELECT ?person ?personLabel ?birthDate ?birthPlaceLabel ?deathDate ?occupationLabel ?awardLabel ?countryLabel WHERE {
10 VALUES ?award { wd:Q38104 wd:Q35637 wd:Q44585 wd:Q37922 wd:Q80061 wd:Q135444 }
11 ?person wdt:P166 ?award .
12 ?person wdt:P31 wd:Q5 .
13 OPTIONAL { ?person wdt:P569 ?birthDate . }
14 OPTIONAL { ?person wdt:P19 ?birthPlace . }
15 OPTIONAL { ?person wdt:P570 ?deathDate . }
16 OPTIONAL { ?person wdt:P106 ?occupation . }
17 OPTIONAL { ?person wdt:P27 ?country . }
18 SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". }
19}
20ORDER BY DESC(?birthDate)
21LIMIT 300""",
22 "maxResults": 300,
23 "proxyConfiguration": { "useApifyProxy": True },
24}
25
26
27run = client.actor("logiover/wikidata-scraper").call(run_input=run_input)
28
29
30print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
31for item in client.dataset(run.default_dataset_id).iterate_items():
32 print(item)
33
34