Windows 10 automation tool that:
- Opens regular Google Chrome (default profile, not incognito)
- Goes to https://www.pinterest.com/pin-creation-tool/
- Speaks a prompt asking you to type:
- ChatGPT prompt
- Board name
- Destination link
- Uses OpenRouter OpenAI API to generate only useful data: Title, Description, Tags
- Fills the fields on Pinterest, uploads a random image from your folder without repeating until all are used, selects the board, sets the link, and publishes
- Repeats in a loop
- Windows 10 with Google Chrome installed
- You are logged into Pinterest in Chrome’s Default profile
- An OpenRouter API key
- An images folder at
Z:\family(or setIMAGES_DIRto your path)
- Create a
.envfile in the repo root:
# Prefer OPENROUTER_API_KEY; OPENAI_API_KEY is also accepted as a fallback
OPENROUTER_API_KEY=sk-or-...
# or:
# OPENAI_API_KEY=sk-or-...
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
OPENROUTER_MODEL=openrouter/auto
IMAGES_DIR=Z:\family
# Delay between pins in seconds
RATE_LIMIT_SECONDS=8
- Install Python dependencies (optional if using the .exe):
pip install -r requirements.txt
python -m pinterest_bot
- The app will speak a message asking you to type your prompt, board name, and link.
- If Chrome is not logged in to Pinterest, the bot will wait and automatically continue once your Chrome session becomes authenticated.
- The tool will generate content, fill the fields, click image upload, wait ~10 seconds, upload a random non-repeated image from your images folder, select the board, set the link, and publish.
- It will then ask if you want to run again.
Build locally on Windows 10 using PyInstaller:
- Install Python 3.12 (recommend adding to PATH).
- In a terminal at the repo root:
- pip install -r requirements.txt
- pip install pyinstaller
- pyinstaller --onefile -n PinterestBot src/pinterest_bot/main.py
- The executable will be at dist/PinterestBot.exe.
Runtime:
- Place a
.envfile next to PinterestBot.exe (or run from a folder that has.env) with your key and IMAGES_DIR. - Ensure Chrome is logged in on the Default profile.
State is stored at %APPDATA%\PinterestBot\state.json. It tracks used image paths. When all images have been used, it resets and starts over.
- Tags are comma-separated. If Pinterest’s tags input is not present, hashtags are appended at the end of the description.
- This tool does not automate chat.openai.com; it uses the OpenRouter API.
- The API key is loaded from
.envand is not committed. It prefersOPENROUTER_API_KEY, but will also useOPENAI_API_KEYif present.
- If selectors change on Pinterest, fields may not be found. Open an issue with details.
- If you see login pages, complete login in the opened Chrome window; the bot will continue automatically once authenticated.
-
Automated login detection: the bot detects Pinterest login state without requiring console input. If not logged in, it waits until the session becomes authenticated.
-
Directory changes: the bot rescans the images directory on every run and prunes missing files from state. New images are discovered automatically; no repeats until all images are used.
-
API resilience: OpenRouter calls use retries with exponential backoff and strict JSON extraction with a fallback parser. Tags are sanitized to remove special characters.
-
Cross-platform paths: Windows paths are normalized; Chrome user data directories are selected per platform. State and logs live at %APPDATA%\PinterestBot on Windows.
-
Error logging: logs are written to %APPDATA%\PinterestBot\logs.txt and also printed to console.
-
Rate limiting: set RATE_LIMIT_SECONDS in .env to control delay between pins.
-
Input validation: destination URL and board name are validated before attempting to publish.
-
Improved selectors: more resilient Pinterest element selectors and longer, staged waits for dynamic UI.
-
If no images are found in your folder, set
IMAGES_DIRto the correct path in.env.