Dataset Image Downloader & Uploader avatar
Dataset Image Downloader & Uploader

Pricing

Pay per usage

Go to Store
Dataset Image Downloader & Uploader

Dataset Image Downloader & Uploader

lukaskrivka/images-download-upload

Developed by

Lukáš Křivka

Maintained by Community

Download image files from image URLs in your datasets and save them to a Zip file, Key-Value store, or directly your AWS S3 bucket.

0.0 (0)

Pricing

Pay per usage

18

Monthly users

86

Runs succeeded

>99%

Response time

11 days

Last modified

2 months ago

You can access the Dataset Image Downloader & Uploader programmatically from your own applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4// Replace the '<YOUR_API_TOKEN>' with your token
5const client = new ApifyClient({
6    token: '<YOUR_API_TOKEN>',
7});
8
9// Prepare Actor input
10const input = {
11    "pathToImageUrls": "images",
12    "fileNameFunction": ({url, md5}) => md5(url),
13    "uploadTo": "zip-file",
14    "preDownloadFunction": `/* Example: We get rid of the items with price 0
15        ({ data }) => data.filter((item) => item.price > 0)
16        */`,
17    "postDownloadFunction": `/* Example: We remove items without any successfully uploaded images.
18         We also remove any image URLs that were not uploaded
19         
20         ({ data, state }) => {
21            return data.reduce((newData, item) => {
22                const downloadedImages = item.images.filter((imageUrl) => {
23                    return state[imageUrl] && state[imageUrl].imageUploaded;
24                });
25                
26                if (downloadedImages.length === 0) {
27                    return newData;
28                }
29                
30                return newData.concat({ ...item, images: downloadedImages });
31            }, []);
32        }
33        */`,
34    "imageCheckType": "content-type",
35    "proxyConfiguration": {
36        "useApifyProxy": true
37    }
38};
39
40// Run the Actor and wait for it to finish
41const run = await client.actor("lukaskrivka/images-download-upload").call(input);
42
43// Fetch and print Actor results from the run's dataset (if any)
44console.log('Results from dataset');
45console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
46const { items } = await client.dataset(run.defaultDatasetId).listItems();
47items.forEach((item) => {
48    console.dir(item);
49});
50
51// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

Dataset Image Downloader & Uploader API in JavaScript

The Apify API client for JavaScript is the official library that allows you to use Dataset Image Downloader & Uploader API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.

Install the apify-client

npm install apify-client

Other API clients include:

Pricing

Pricing model

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage.