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.
- β 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
alttext for media as metadatacommentin the downloaded media for searchability. - β
Optionally save
alttext 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 chromeor--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).
- π² Not able to scrape nested boards yet. (Supported since #69)
- Python 3.10 or newer
- (Optional) Playwright browsers:
playwright install chromiumorplaywright install firefox - (Optional) For Selenium backend: Chrome or Firefox browser with matching WebDriver
- (Optional) ffmpeg for video remuxing to MP4 (with
--videooption). If remux fails, automatically falls back to re-encoding. Use--skip-remuxto download raw .ts files without ffmpeg. - (Optional) For image resolution detection and pruning, requires
pillowlibrary. Install withpip install pinterest-dl[image]. - (Optional) For embedding
alttext as metadata comment, requirespyexiv2library. Install withpip install pinterest-dl[exif].
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 featuresexif- Installs pyexiv2 for EXIF metadata embedding (alt text as metadata comment)metadata- Installs both Pillow and pyexiv2all- 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.
git clone https://github.com/sean1832/pinterest-dl.git
cd pinterest-dl
pip install .
# Or with optional dependencies
pip install .[all]
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
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
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
- CLI Guide - Complete command-line interface documentation
- Python API Guide - Programmatic usage examples and patterns
- Contributing Guidelines - How to contribute to the project
We welcome contributions! Please see CONTRIBUTING.md for:
- Code of Conduct
- Commit message guidelines (semantic commits)
- Pull request process
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.
