Dataset Image Downloader & Uploader
No credit card required
Dataset Image Downloader & Uploader
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.
Do you want to learn more about this Actor?
Get a demoYou can access the Dataset Image Downloader & Uploader programmatically from your own Python 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.
1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "pathToImageUrls": "images",
10 "fileNameFunction": "({url, md5}) => md5(url)",
11 "uploadTo": "zip-file",
12 "preDownloadFunction": """/* Example: We get rid of the items with price 0
13({ data }) => data.filter((item) => item.price > 0)
14*/""",
15 "postDownloadFunction": """/* Example: We remove items without any successfully uploaded images.
16 We also remove any image URLs that were not uploaded
17
18 ({ data, state }) => {
19 return data.reduce((newData, item) => {
20 const downloadedImages = item.images.filter((imageUrl) => {
21 return state[imageUrl] && state[imageUrl].imageUploaded;
22 });
23
24 if (downloadedImages.length === 0) {
25 return newData;
26 }
27
28 return newData.concat({ ...item, images: downloadedImages });
29 }, []);
30}
31*/""",
32 "imageCheckType": "content-type",
33 "proxyConfiguration": { "useApifyProxy": True },
34}
35
36# Run the Actor and wait for it to finish
37run = client.actor("lukaskrivka/images-download-upload").call(run_input=run_input)
38
39# Fetch and print Actor results from the run's dataset (if there are any)
40print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
41for item in client.dataset(run["defaultDatasetId"]).iterate_items():
42 print(item)
43
44# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Dataset Image Downloader & Uploader API in Python
The Apify API client for Python is the official library that allows you to use Dataset Image Downloader & Uploader API in Python, providing convenience functions and automatic retries on errors.
Install the apify-client
pip install apify-client
Other API clients include:
Actor Metrics
36 monthly users
-
13 stars
>99% runs succeeded
2 days response time
Created in Nov 2018
Modified 23 days ago