This script allows users to scrape Pinterest pin data for a specified user and category. It uses the Selenium browser automation tool to navigate Pinterest and extract the desired data, including titles and URLs.
-
Ensure you have Python (version 3.6 or newer) installed.
-
Install the required Python packages:
pip install selenium pandas
-
Download ChromeDriver appropriate for your version of Chrome browser. Ensure the
chromedriver
executable is placed in a location in your system's PATH or in the same directory as the script.
-
Navigate to the directory containing the script.
-
Run:
python scraper.py
-
Follow the prompts to enter the Pinterest
username
andcategory
you wish to scrape. -
The script will then retrieve the pin data and save it as an Excel file in the same directory.
- Error Handling: Automatically logs errors that arise during the scraping process to
error_log.txt
. - Headless Mode: Operates the browser in a "headless" mode, so no GUI will be displayed.
- Dynamic File Naming: Generates Excel filenames based on the provided Pinterest username and category, ensuring no overwrites.
- Some delays are built into the script to avoid making too-rapid requests to Pinterest. Adjust the delay times in the script if needed.
- Always ensure you are compliant with Pinterest's terms of service or any other website's when scraping.
- Make sure the ChromeDriver version matches your Chrome browser's version.
This project is open source. Please note that while the code can be used freely, the user is responsible for how it is employed.