Dataset Image Downloader & Uploader avatar
Dataset Image Downloader & Uploader
Try for free

No credit card required

View all Actors
Dataset Image Downloader & Uploader

Dataset Image Downloader & Uploader

lukaskrivka/images-download-upload
Try for free

No credit card required

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.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn mode

Node.js

Python

curl

1# Set API token
2API_TOKEN=<YOUR_API_TOKEN>
3
4# Prepare Actor input
5cat > input.json <<'EOF'
6{
7  "pathToImageUrls": "images",
8  "fileNameFunction": "({url, md5}) => md5(url)",
9  "uploadTo": "zip-file",
10  "preDownloadFunction": "/* Example: We get rid of the items with price 0\n({ data }) => data.filter((item) => item.price > 0)\n*/",
11  "postDownloadFunction": "/* Example: We remove items without any successfully uploaded images.\n We also remove any image URLs that were not uploaded\n \n ({ data, state }) => {\n    return data.reduce((newData, item) => {\n        const downloadedImages = item.images.filter((imageUrl) => {\n            return state[imageUrl] && state[imageUrl].imageUploaded;\n        });\n        \n        if (downloadedImages.length === 0) {\n            return newData;\n        }\n        \n        return newData.concat({ ...item, images: downloadedImages });\n    }, []);\n}\n*/",
12  "imageCheckType": "content-type",
13  "proxyConfiguration": {
14    "useApifyProxy": true
15  }
16}
17EOF
18
19# Run the Actor using an HTTP API
20# See the full API reference at https://docs.apify.com/api/v2
21curl "https://api.apify.com/v2/acts/lukaskrivka~images-download-upload/runs?token=$API_TOKEN" \
22  -X POST \
23  -d @input.json \
24  -H 'Content-Type: application/json'
Developer
Maintained by Apify
Actor metrics
  • 12 monthly users
  • 97.7% runs succeeded
  • 10.7 days response time
  • Created in Nov 2018
  • Modified 29 days ago