# Pinterest Board Image Downloader (`tamkungz/pinfetch`) Actor

Scrape Pinterest image URLs with Playwright, auto-download files, and export all downloaded images as a ZIP (IMAGES\_ZIP). Includes per-image dataset records and run summary output for easy tracking and reuse.

- **URL**: https://apify.com/tamkungz/pinfetch.md
- **Developed by:** [TamKungZ\_](https://apify.com/tamkungz) (community)
- **Categories:** Automation, Social media
- **Stats:** 19 total users, 2 monthly users, 97.2% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.10 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## PinFetch - Pinterest Board Image Scraper & Downloader (Apify Actor)

Pinterest image scraper and downloader for Apify Actor, built with Python + Playwright. Collect high-quality Pinterest image URLs, download images automatically, and export downloaded files as ZIP.

**Keywords:** Pinterest scraper, Pinterest image downloader, Apify Pinterest Actor, Playwright scraper, Pinterest image URL extractor, bulk image download, Pinterest automation, pinimg originals

### Description (for Apify SEO)

Scrape Pinterest image URLs with Playwright, download images in bulk, and export all downloaded files as a ZIP (`IMAGES_ZIP`). Includes per-image dataset output and run summary (`OUTPUT`) for reliable Pinterest data workflows.

### What this Pinterest Scraper Actor does

- Opens a Pinterest page with Playwright.
- Scrolls the page and collects unique `pinimg.com` image URLs.
- Normalizes image URLs to original quality (`/originals/`).
- Downloads images to a local folder inside the Actor container.
- Pushes per-image status records to the dataset.
- Creates a ZIP of downloaded images and stores it in KV store as `IMAGES_ZIP`.
- Stores run summary in KV store key `OUTPUT`.

### Input

Input is defined in [`.actor/input_schema.json`](.actor/input_schema.json).

- `url` (string, required): Pinterest profile/board/pin URL to scrape.
- `max_scroll` (integer): Maximum number of scroll rounds.
- `max_no_new` (integer): Stop after N rounds with no new image URLs.
- `max_images` (integer, optional): Stop early when collected image count reaches this limit.
- `scroll_delay_sec` (number): Delay between scroll rounds.
- `save_dir` (string): Directory for downloaded files in container.
- `request_timeout_sec` (integer): HTTP timeout per image request.
- `download_delay_sec` (number): Delay between each download.
- `headless` (boolean): Run Chromium in headless mode.

### Output

#### 1) Dataset (image URL results)

Schema: [`.actor/dataset_schema.json`](.actor/dataset_schema.json)

Each item includes:

- `source_url`
- `image_url`
- `file_name`
- `status`
- `status_code`
- `error`

#### 2) Downloaded images ZIP

- KV key: `IMAGES_ZIP`
- Exposed by output schema in [`.actor/output_schema.json`](.actor/output_schema.json)

#### 3) Run summary (`OUTPUT`)

KV key: `OUTPUT`

Typical fields:

- `source_url`
- `image_count`
- `downloaded_count`
- `save_dir`
- `zip_key`
- `zip_file_name`
- `zip_file_count`

### How to download ZIP from Apify Console

After the run is finished, open the run page (example):

- `https://console.apify.com/actors/KiITVfqPpB73YtURf/runs/auVvwyqn3agMvVg7o#output`

Then:

1. Go to **Output** section.
2. You will initially see **Image URL dataset**.
3. Click the dropdown (arrow-down icon).
4. Change selection to **Downloaded images ZIP**.
5. The ZIP download will start automatically (or a download link will appear).

If needed, download directly from KV record URL:

- `https://api.apify.com/v2/key-value-stores/8LWpZk3wuuBpR0rRr/records/IMAGES_ZIP`

Generic format:

- `https://api.apify.com/v2/key-value-stores/<KEY_VALUE_STORE_ID>/records/IMAGES_ZIP`

### Run locally

```bash
apify run
````

### Deploy

```bash
apify login
apify push
```

### Main code

- Runtime entrypoint: [`src/main.py`](src/main.py)
- Original reference logic: [`.mycode/pin.py`](.mycode/pin.py)

# Actor input Schema

## `url` (type: `string`):

Pinterest profile or ref URL to scrape image URLs from

## `max_scroll` (type: `integer`):

Maximum number of scroll iterations

## `max_no_new` (type: `integer`):

Stop crawl after this many consecutive rounds with no newly found images

## `max_reloads` (type: `integer`):

When max\_no\_new is reached, reload page this many times before final stop

## `reload_only_below_total` (type: `integer`):

Allow stall-reload only while collected image total is below this threshold (helps avoid unnecessary reloads later)

## `max_images` (type: `integer`):

Stop scraping early when this many unique images have been collected

## `scroll_delay_sec` (type: `number`):

Delay between scroll rounds in seconds

## `save_dir` (type: `string`):

Directory path inside Actor container where images are downloaded

## `request_timeout_sec` (type: `integer`):

HTTP timeout for each image download request

## `download_delay_sec` (type: `number`):

Sleep delay between each file download

## `headless` (type: `boolean`):

Run Chromium in headless mode

## Actor input object example

```json
{
  "url": "https://www.pinterest.com/TamKungZ_/ref/",
  "max_scroll": 300,
  "max_no_new": 5,
  "max_reloads": 2,
  "reload_only_below_total": 30,
  "scroll_delay_sec": 1.2,
  "save_dir": "pinterest_images",
  "request_timeout_sec": 30,
  "download_delay_sec": 0.25,
  "headless": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `imagesZip` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "url": "https://www.pinterest.com/TamKungZ_/ref/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("tamkungz/pinfetch").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "url": "https://www.pinterest.com/TamKungZ_/ref/" }

# Run the Actor and wait for it to finish
run = client.actor("tamkungz/pinfetch").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "url": "https://www.pinterest.com/TamKungZ_/ref/"
}' |
apify call tamkungz/pinfetch --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=tamkungz/pinfetch",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Pinterest Board Image Downloader",
        "description": "Scrape Pinterest image URLs with Playwright, auto-download files, and export all downloaded images as a ZIP (IMAGES_ZIP). Includes per-image dataset records and run summary output for easy tracking and reuse.",
        "version": "0.1",
        "x-build-id": "QLsUSLjit6M2ZZPLO"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/tamkungz~pinfetch/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-tamkungz-pinfetch",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/tamkungz~pinfetch/runs": {
            "post": {
                "operationId": "runs-sync-tamkungz-pinfetch",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/tamkungz~pinfetch/run-sync": {
            "post": {
                "operationId": "run-sync-tamkungz-pinfetch",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "url"
                ],
                "properties": {
                    "url": {
                        "title": "Pinterest page URL",
                        "type": "string",
                        "description": "Pinterest profile or ref URL to scrape image URLs from",
                        "default": "https://www.pinterest.com/TamKungZ_/ref/"
                    },
                    "max_scroll": {
                        "title": "Maximum scroll rounds",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of scroll iterations",
                        "default": 300
                    },
                    "max_no_new": {
                        "title": "Stop after no new images",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Stop crawl after this many consecutive rounds with no newly found images",
                        "default": 5
                    },
                    "max_reloads": {
                        "title": "Reload attempts after stall",
                        "minimum": 0,
                        "type": "integer",
                        "description": "When max_no_new is reached, reload page this many times before final stop",
                        "default": 2
                    },
                    "reload_only_below_total": {
                        "title": "Reload only below total images",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Allow stall-reload only while collected image total is below this threshold (helps avoid unnecessary reloads later)",
                        "default": 30
                    },
                    "max_images": {
                        "title": "Maximum images to collect",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Stop scraping early when this many unique images have been collected"
                    },
                    "scroll_delay_sec": {
                        "title": "Scroll delay (seconds)",
                        "minimum": 0,
                        "type": "number",
                        "description": "Delay between scroll rounds in seconds",
                        "default": 1.2
                    },
                    "save_dir": {
                        "title": "Save directory",
                        "type": "string",
                        "description": "Directory path inside Actor container where images are downloaded",
                        "default": "pinterest_images"
                    },
                    "request_timeout_sec": {
                        "title": "Download request timeout (seconds)",
                        "minimum": 1,
                        "type": "integer",
                        "description": "HTTP timeout for each image download request",
                        "default": 30
                    },
                    "download_delay_sec": {
                        "title": "Delay between downloads (seconds)",
                        "minimum": 0,
                        "type": "number",
                        "description": "Sleep delay between each file download",
                        "default": 0.25
                    },
                    "headless": {
                        "title": "Headless browser",
                        "type": "boolean",
                        "description": "Run Chromium in headless mode",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
