1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "urls": [
12 {
13 "url": "https://apify.com"
14 },
15 {
16 "url": "https://picsum.photos/800/600.jpg"
17 }
18 ],
19 "includeSrcset": true,
20 "includeOgTags": true,
21 "minWidth": 0,
22 "minHeight": 0,
23 "minSizeBytes": 0,
24 "maxImagesPerUrl": 1000,
25 "maxUrls": 10000,
26 "dedupByHash": true,
27 "stripExif": false,
28 "filenamePattern": "{slug}-{hash}.{ext}",
29 "outputFormat": [
30 "dataset",
31 "kv-store"
32 ],
33 "s3Bucket": "",
34 "webhookUrl": "",
35 "maxConcurrency": 10,
36 "downloadTimeoutMs": 15000,
37 "imageCheckMaxRetries": 3,
38 "proxyConfiguration": {
39 "useApifyProxy": false
40 },
41 "failFast": false,
42 "debugLogging": false
43};
44
45
46const run = await client.actor("getascraper/bulk-image-downloader").call(input);
47
48
49console.log('Results from dataset');
50console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
51const { items } = await client.dataset(run.defaultDatasetId).listItems();
52items.forEach((item) => {
53 console.dir(item);
54});
55
56