1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "input": "// Available packages:\n// - Apify Actor - https://docs.apify.com/sdk/js/reference/class/Actor\n// - example:\n// await Actor.pushData({ my : 'data'});\n// - Axios - https://axios-http.com/\n// - example:\n// log.info(`Current IP is: ${(await Axios.get('https://ipinfo.io/json')).data.ip}`)\n// - Moment.js - https://momentjs.com/\n// - example:\n// log.info(`Tomorrow is: ${moment().add(1, 'day').toISOString()}`)\n\nconst waitTime = Math.ceil(5 + Math.random() * 10);\n\nreturn {\n minWaitTime: waitTime,\n maxWaitTime: waitTime + 2_000\n}",
12 "proxyConfiguration": {
13 "useApifyProxy": true
14 }
15};
16
17
18const run = await client.actor("useful-tools/dynamic-input").call(input);
19
20
21console.log('Results from dataset');
22console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
23const { items } = await client.dataset(run.defaultDatasetId).listItems();
24items.forEach((item) => {
25 console.dir(item);
26});
27
28