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 ?countryLabel WHERE {
10 ?person wdt:P166 wd:Q38104 .
11 ?person wdt:P31 wd:Q5 .
12 OPTIONAL { ?person wdt:P569 ?birthDate . }
13 OPTIONAL { ?person wdt:P19 ?birthPlace . }
14 OPTIONAL { ?person wdt:P570 ?deathDate . }
15 OPTIONAL { ?person wdt:P27 ?country . }
16 SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". }
17}
18LIMIT 300""",
19 "maxResults": 300,
20 "proxyConfiguration": { "useApifyProxy": True },
21}
22
23
24run = client.actor("logiover/wikidata-scraper").call(run_input=run_input)
25
26
27print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
28for item in client.dataset(run.default_dataset_id).iterate_items():
29 print(item)
30
31