1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "requests": [
12 {
13 "id": "crawlee-issues",
14 "url": "https://api.github.com/repos/apify/crawlee/issues",
15 "query": {
16 "per_page": "5",
17 "state": "all"
18 },
19 "headers": {
20 "Accept": "application/vnd.github+json"
21 }
22 },
23 {
24 "id": "example-page",
25 "url": "https://example.com/"
26 }
27 ],
28 "pagination": {
29 "type": "linkHeader",
30 "maxPages": 2
31 },
32 "extract": {
33 "titles": "$[*].title",
34 "numbers": "$[*].number"
35 }
36};
37
38
39const run = await client.actor("steadyline/http-request-runner").call(input);
40
41
42console.log('Results from dataset');
43console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
44const { items } = await client.dataset(run.defaultDatasetId).listItems();
45items.forEach((item) => {
46 console.dir(item);
47});
48
49