Pinterest Image Scraper
Now you can take the URL to any Pinterest board (or a CSV of a bunch of boards) and return a Python list of the URLs to the hi-rez versions of all of the images on the board.
Requirements:
- Python 3.5+ (Anaconda recommended)
- Pandas (pip install pandas or conda install pandas)
- Firefox + Gecko driver (Firefox can be omitted if you know what you're doing and have another browser set up to be used via Selenium)
- Selenium (
pip install selenium
orconda install -c conda-forge selenium
, then see these instructions for installing the Gecko driver if not installing it from Conda) - Alternatively, install the Gecko driver using conda:
conda install -c conda-forge geckodriver
- If you want to use Chrome or PhantomJS, install their respective selenium drivers:
conda install python-chromedriver-binary phantomjs
- A Pinterest Account
How to Run:
git clone https://github.com/xjdeng/pinterest-image-scraper.git
cd pinterest-image-scraper
pip install -U .
cd ..
python
from pinterest_scraper import scraper as s
ph = s.Pinterest_Helper(<Pinterst login> , <Pinterest password>)
images = ph.runme("http://URL-to-image-board")
Or if you have a CSV file with a URL to a different image board on every line:
images = ph.getURLs(imageboards.csv)
Now if you want to download these images:
s.download(images, "/path/to/your/destination/dir")
or to download to your current directory:
s.download(images)
Note: you no longer need Firefox. If you'd like to use a different browser (i.e. Chrome or PhantomJS), you'll need to initialize it through selenium, then pass it through the Pinterest_Helper object. For example, using Chrome:
from selenium import webdriver
chrome = webdriver.Chrome()
ph = s.Pinterest_Helper(<Pinterst login> , <Pinterest password>, chrome)