Skip to main content

An unofficial Pinterest image downloader

Project description

Pinterest Media Downloader (pinterest-dl)

PyPI - Version PyPI - Python Version PyPI - License Downloads

Buy Me A Coffee

English | 中文

[!NOTE] Version 1.0 is here! This release brings improved stability, better error handling, and enhanced testing (56 comprehensive tests). All existing code continues to work without any changes - we've maintained full backward compatibility.

This library facilitates the scraping and downloading of medias (including images and video stream) from Pinterest. Using reverse engineered Pinterest API and browser automation (Playwright by default, with Selenium as fallback), it enables users to extract images from a specified Pinterest URL and save them to a chosen directory.

It includes a CLI for direct usage and a Python API for programmatic access. The tool supports scraping medias from public and private boards and pins using browser cookies. It also allows users to save scraped URLs to a JSON file for future access.

[!TIP] If you are looking for a GUI version of this tool, check out pinterest-dl-gui. It provides a user-friendly interface for scraping and downloading media from Pinterest using the same underlying library. It could also serve as a reference for integrating the library into your own GUI application.

[!WARNING] This project is independent and not affiliated with Pinterest. It's designed solely for educational purposes. Please be aware that automating the scraping of websites might conflict with their Terms of Service. The repository owner disclaims any liability for misuse of this tool. Use it responsibly and at your own legal risk.

[!NOTE] This project draws inspiration from pinterest-image-scraper.

Table of Contents

🌟 Features

  • ✅ Scrape media directly from a Pinterest URL.
  • ✅ Asynchronously download media from a list of URLs. (#1)
  • ✅ Save scraped URLs to a JSON file for future access.
  • ✅ Incognito mode to keep your scraping discrete.
  • ✅ Access detailed output for effective debugging.
  • ✅ Support for the Firefox browser.
  • ✅ Insert alt text for media as metadata comment in the downloaded media for searchability.
  • ✅ Optionally save alt text as a separate text file for each media. (#32)
  • ✅ Scrape private boards and pins with browser cookies. (#20)
  • ✅ Scrape media using reversed engineered Pinterest API. (This will be default behaviour. You can use webdriver by specifying --client chrome or --client firefox) (#21)
  • ✅ Search for media on Pinterest using a query. (#23)
  • ✅ Support multiple urls and queries in a single command.
  • ✅ Support for batch processing of URLs and queries from files.
  • ✅ Download video streams if available.
  • Playwright support - faster and more reliable browser automation (default), with Selenium as fallback (--backend selenium).

🚩 Known Issues

- 🔲 Not able to scrape nested boards yet. (Supported since #69)

📋 Requirements

  • Python 3.10 or newer
  • (Optional) Playwright browsers: playwright install chromium or playwright install firefox
  • (Optional) For Selenium backend: Chrome or Firefox browser with matching WebDriver
  • (Optional) ffmpeg for video remuxing to MP4 (with --video option). If remux fails, automatically falls back to re-encoding. Use --skip-remux to download raw .ts files without ffmpeg.
  • (Optional) For image resolution detection and pruning, requires pillow library. Install with pip install pinterest-dl[image].
  • (Optional) For embedding alt text as metadata comment, requires pyexiv2 library. Install with pip install pinterest-dl[exif].

📥 Installation

Using pip (Recommended)

Basic installation (core functionality only):

pip install pinterest-dl

With optional dependencies:

# With image operations (resolution detection, pruning)
pip install pinterest-dl[image]

# With EXIF metadata support (embed alt text as metadata)
pip install pinterest-dl[exif]

# With all image/metadata features
pip install pinterest-dl[metadata]

# For development (includes testing tools)
pip install pinterest-dl[dev,all]

[!NOTE] Optional Dependencies:

  • image - Installs Pillow for image resolution detection and pruning features
  • exif - Installs pyexiv2 for EXIF metadata embedding (alt text as metadata comment)
  • metadata - Installs both Pillow and pyexiv2
  • all - Installs all optional dependencies (Currently Pillow and pyexiv2)
  • dev - Installs testing tools (pytest, pytest-mock)

Without optional dependencies, you can still scrape and download images, but features requiring image analysis (resolution detection, metadata embedding) will raise an informative error.

Cloning from GitHub

git clone https://github.com/sean1832/pinterest-dl.git
cd pinterest-dl
pip install .
# Or with optional dependencies
pip install .[all]

🚀 Quick Start

CLI Usage

Scrape images from Pinterest using the command line:

# Scrape from a Pinterest board or pin
pinterest-dl scrape <url> -o output_folder -n 50

# Download videos as MP4 (requires ffmpeg)
pinterest-dl scrape <url> --video -o output_folder

# Download videos as raw .ts files (no ffmpeg needed)
pinterest-dl scrape <url> --video --skip-remux -o output_folder

# Search for images
pinterest-dl search "nature photography" -o output_folder -n 30

# Login to access private boards
pinterest-dl login -o cookies.json

📖 View Full CLI Documentation ->

Available commands: login, scrape, search, download


Python API

Use PinterestDL programmatically in your Python code:

from pinterest_dl import PinterestDL

# Quick scrape and download
images = PinterestDL.with_api().scrape_and_download(
    url="https://www.pinterest.com/pin/1234567",
    output_dir="images/art",
    num=30
)

# Search for images
images = PinterestDL.with_api().search_and_download(
    query="landscape art",
    output_dir="images/landscapes",
    num=50
)

📖 View Full API Documentation ->

Includes: High-level API, private board access, advanced scraping patterns

💡 See Complete Examples ->

Working examples covering:

  • Basic scraping and downloading
  • Search functionality
  • Cookie authentication for private boards
  • Video downloading
  • Advanced control with lower-level API
  • Debug mode and troubleshooting

📚 Documentation

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for:

  • Code of Conduct
  • Commit message guidelines (semantic commits)
  • Pull request process

📜 License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.


Made with ❤️ by sean1832

Note: This project is not affiliated with Pinterest. All trademarks are property of their respective owners.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinterest_dl-1.1.2.tar.gz (71.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinterest_dl-1.1.2-py3-none-any.whl (74.5 kB view details)

Uploaded Python 3

File details

Details for the file pinterest_dl-1.1.2.tar.gz.

File metadata

  • Download URL: pinterest_dl-1.1.2.tar.gz
  • Upload date:
  • Size: 71.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pinterest_dl-1.1.2.tar.gz
Algorithm Hash digest
SHA256 87208fa2b5bfc8608ca441b89248d9796396c8d9f8ed1dc62d71cb10ad68682a
MD5 a3b1e50d8701e47a9c725b7bf6b93ff3
BLAKE2b-256 84a91fc5c02d4961e617d114405cee1f4fe8ea515670af6edde8f71ad8e3ee6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinterest_dl-1.1.2.tar.gz:

Publisher: release_pypi.yml on sean1832/pinterest-dl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pinterest_dl-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: pinterest_dl-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 74.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pinterest_dl-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cf7dc305ac82c526db420087b50c3011a34a795a8c56b4ace6ae49d005b8aaa3
MD5 337f73093a104a9899aa00c990a3b1f0
BLAKE2b-256 bdf4084a05c4318b847ad635f73f75f537e9fc6c98b2c241dffe99e2b4e93859

See more details on using hashes here.

Provenance

The following attestation bundles were made for pinterest_dl-1.1.2-py3-none-any.whl:

Publisher: release_pypi.yml on sean1832/pinterest-dl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page