This CLI (Command Line Interface) tool facilitates the scraping and downloading of images from Pinterest. Using Selenium for automation, it enables users to extract images from a specified Pinterest URL and save them to a chosen directory.
β οΈ Disclaimer:
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 images directly from a Pinterest URL.
- β Asynchronously download images from a list of URLs. (see pull request)
- β Save scraped URLs to a JSON file for future access.
- β Incognito mode to keep your scraping discreet.
- β Access detailed output for effective debugging.
- β Support for the Firefox browser.
- β
Insert
alt
text for images as metadatacomment
in the downloaded image for searchability.
- π² Experimental Firefox browser support might not perform as expected.
- π² Limited functionality with Pinterest URLs requiring login.
- π² Incompatibility with Pinterest URLs that include search queries.
- π² Currently does not support MacOS and Linux platforms.
- Python 3.10 or newer
- Chrome or Firefox browser
pip install pinterest-dl
git clone https://github.com/sean1832/pinterest-dl.git
cd pinterest-dl
pip install .
pinterest-dl [command] [options]
Scraping Images:
Scrape images to the ./images/art
directory from the Pinterest URL https://www.pinterest.com/pin/1234567
with a limit of 30
images and a minimum resolution of 512x512
. Save scraped URLs to a JSON
file.
pinterest-dl scrape "https://www.pinterest.com/pin/1234567" "images/art" -l 30 -r 512x512 --json
Downloading Images:
Download images from the art.json
file to the ./downloaded_imgs
directory with a minimum resolution of 1024x1024
.
pinterest-dl download art.json -o downloaded_imgs -r 1024x1024
Extract images from a specified Pinterest URL.
Syntax:
pinterest-dl scrape [url] [output_dir] [options]
Options:
-l
,--limit [number]
: Max number of image to download (default: 100).-r
,--resolution [width]x[height]
: Minimum image resolution for download (e.g., 512x512).--timeout [second]
: Timeout in seconds for requests (default: 3).--incognito
: Activate incognito mode for scraping.--json
: Save scraped URLs to a JSON file.--dry-run
: Execute scrape without downloading images.--firefox
: Opt for Firefox as the scraping browser.--headful
: Run in headful mode with browser window.--verbose
: Enable detailed output for debugging.
Download images from a list of URLs provided in a file.
Syntax:
pinterest-dl download [url_list] [options]
Options:
-o
,--output [directory]
: Output directory (default: ./<json_filename>).-r
,--resolution [width]x[height]
: minimum resolution to download (e.g. 512x512).--verbose
: Enable verbose output.