A Python application that automatically pins images from Shutterstock to a Pinterest board. This application is designed to scrape images from a specified Shutterstock user collection and automatically add them to your Pinterest account.
- Automated image scraping and pinning to Pinterest
- Database tracking to prevent duplicate pins
- Random user agent usage
- Error tolerance and automatic retry mechanism
- Configurable sleep times
- Modular and extensible code structure
- Python 3.7 or higher
- Pinterest account
- Internet connection
- Clone the repository:
git clone https://github.com/barisariburnu/python-shutterstock-pinner.git
cd python-shutterstock-pinner- Install the required dependencies:
pip install -r requirements.txtBefore using the application, fill in your credentials in the config.py file:
PINTEREST_EMAIL = 'your_pinterest_email@example.com'
PINTEREST_USERNAME = 'your_pinterest_username'
PINTEREST_PASSWORD = 'your_pinterest_password'
PINTEREST_BOARD_ID = 'your_board_id'
SHUTTERSTOCK_USERNAME = 'your_shutterstock_username'
SHUTTERSTOCK_SORT_BY = 'popular' # 'popular' or 'newest'
SLEEP_TIME = 420 # Time between pins (in seconds)
MAX_RETRIES = 3 # Maximum retry attempts
RETRY_DELAY = 60 # Delay between retries (in seconds)
MAX_PAGES = 100 # Maximum pages to scrape- Log in to your Pinterest account
- Click on the board you want to use
- Copy the ID from the URL:
https://pinterest.com/username/board-name/→ The ID may be in the URL or can be obtained via API
Run the application with:
python main.pyThe application performs the following steps:
- Logs into Pinterest
- Starts scraping the Shutterstock collection (default: 100 pages)
- Scans each page for images
- Pins previously unpinned images to Pinterest
- Waits for the configured time after each operation
- Retries after 60 seconds on error
python-shutterstock-pinner/
├── config.py # Configuration file
├── main.py # Main application file
├── requirements.txt # Python dependencies
├── create_sample_db.py # Sample database generator
├── models/
│ ├── __init__.py
│ ├── pinterest.py # Pinterest API wrapper
│ ├── shutterstock.py # Shutterstock scraper
│ └── user_agents.py # User agent list
├── tests/ # Unit tests
│ ├── test_main.py
│ ├── test_pinterest.py
│ └── test_shutterstock.py
├── database/ # Database files
└── data/ # Pinterest credentials (auto-generated)
The application uses pickledb to track pinned images. The database file is created at database/board_{PINTEREST_BOARD_ID}.db. This prevents the same image from being pinned twice.
The project includes comprehensive unit tests. Run them with:
pytest tests/ -vYou can create a sample database for testing purposes:
python create_sample_db.pyThis creates a sample database at database/board_1234567890123456789.db with test data.
requests~=2.25.1- For HTTP requestsbeautifulsoup4~=4.9.3- For HTML parsingpy3-pinterest~=1.2.2- Pinterest API wrapperpickledb~=0.9.2- For simple database operations
- This application is for educational and personal use only.
- Compliance with Shutterstock and Pinterest's terms of service is your responsibility.
- Automatic pinning may cause your account to be flagged as spam. Adjust the
SLEEP_TIMEparameter to reduce this risk. - Be careful to only pin publicly available and properly licensed images.
- Always respect copyright laws and licensing terms.
We welcome contributions! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For more detailed contribution guidelines, see CONTRIBUTING.md.
The project includes unit tests for all major components:
# Run all tests
pytest tests/ -v
# Run specific test file
pytest tests/test_main.py -v
# Run specific test
pytest tests/test_main.py::TestMain::test_parse_image_url -vWe follow PEP 8 style guidelines. Please ensure your code adheres to these standards before submitting pull requests.
This project is licensed under the MIT License. See the LICENSE file for more information.
This software is provided "as is", without warranty of any kind. The authors or contributors are not responsible for any damages resulting from the use of this software.
If you encounter issues or have suggestions, please open an issue.
- Copyright of Shutterstock images used in this project may belong to Shutterstock.
- Users are expected to respect copyright laws and use only properly licensed images.