1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "sparql": `SELECT ?person ?personLabel ?birthDate ?birthPlaceLabel ?deathDate ?occupationLabel ?awardLabel ?countryLabel WHERE {
12 VALUES ?award { wd:Q38104 wd:Q35637 wd:Q44585 wd:Q37922 wd:Q80061 wd:Q135444 }
13 ?person wdt:P166 ?award .
14 ?person wdt:P31 wd:Q5 .
15 OPTIONAL { ?person wdt:P569 ?birthDate . }
16 OPTIONAL { ?person wdt:P19 ?birthPlace . }
17 OPTIONAL { ?person wdt:P570 ?deathDate . }
18 OPTIONAL { ?person wdt:P106 ?occupation . }
19 OPTIONAL { ?person wdt:P27 ?country . }
20 SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
21}
22ORDER BY DESC(?birthDate)
23LIMIT 300`,
24 "maxResults": 300,
25 "proxyConfiguration": {
26 "useApifyProxy": true
27 }
28};
29
30
31const run = await client.actor("logiover/wikidata-scraper").call(input);
32
33
34console.log('Results from dataset');
35console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
36const { items } = await client.dataset(run.defaultDatasetId).listItems();
37items.forEach((item) => {
38 console.dir(item);
39});
40
41