Py3 pinterest
Fully fledged Python Pinterest client
**py3 pinterest** is a Fully fledged Python Pinterest client The project is written primarily in Python, distributed under the MIT License license, first published in 2019. Key topics include: board, boards, bot, client, cookies.
๐ What's New in v2.0.0
The comeback release. Nearly every core feature has been fixed, modernized, or rewritten.
| Highlight | |
|---|---|
| ๐ฌ | Video pin uploads โ full Story Pin / Idea Pin support via S3 upload flow |
| ๐ผ๏ธ | Image uploads rewritten โ old broken /upload-image/ replaced with working S3 flow |
| ๐ | Pagination fixed โ reset_bookmark bug fixed across all 12 paginated methods |
| ๐ | Login hardened โ cookie banner handling, language-independent selectors, proper cleanup |
| ๐๏ธ | Board deletion โ new delete_board() method |
| ๐ | Board sections โ now supports page_size (up to 100, was hardcoded to 25) |
| ๐ก๏ธ | No more data loss โ Registry no longer rmtree's your directories on init |
| ๐ฆ | Dependency pins โ selenium>=4.0.0, webdriver-manager>=4.0.0 |
| Issue | Description | Status |
|---|---|---|
| #220 | Video upload not supported | โ Fixed |
| #219 | Login โ element not interactable (cookie banner) | โ Fixed |
| #218 | Error in search (pin & board) | โ Fixed |
| #217 | 403 Forbidden โ _ngjs URL prefix | โ Fixed |
| #213 | Search page size & pagination | โ Fixed |
| #209 | pin() unexpected keyword image_path | โ Fixed |
| #208 | load_pin KeyError v3GetPinQuery | โ Fixed |
| #207 | 404 on PinResource/create | โ Fixed |
| #205 | load_pin โ __PWS_DATA__ / props error | โ Fixed |
| #204 | 401 Unauthorized on /upload-image/ | โ Fixed |
| #203 | get_user_pins stops short on large accounts | โ Fixed |
| #202 | Timeout <object> error (selenium 3 + urllib3 2) | โ Fixed |
| #200 | Downstream extruct issue | โ N/A (dependency removed) |
| #195 | Login error โ ChromeDriver URL change | โ Fixed |
| #193 | Login fails for non-English locales | โ Fixed |
| #191 | ChromeDriver download 404 | โ Fixed |
| #188 | 404 on PinResource/create | โ Fixed |
| #187 | get_board_sections limited to 25 | โ Fixed |
| #184 | Bad request โ can't create pins | โ Fixed |
| #181 | 403 Forbidden on PinResource/create | โ Fixed |
| #178 | Can't upload a new pin | โ Fixed |
| #176 | Issue creating pins | โ Fixed |
| #175 | Can't post a new pin | โ Fixed |
| #174 | Pinning fails with HTML output | โ Fixed |
| #156 | Credentials not storing | โ Fixed |
| #148 | Facing problem with pinning image | โ Fixed |
| #147 | How to create video pins? | โ Fixed |
| #139 | data/ directory automatic removal | โ Fixed |
| #138 | KeyError resources in load_pin | โ Fixed |
| #137 | Pin from local file not working | โ Fixed |
| #136 | Pin and delete function not working | โ Fixed |
| #130 | Story pin creation | โ Fixed |
| #108 | Login broken (API updates) | โ Fixed |
๐ฆ Installation
bashpip install py3-pinterest
Requirements: Python 3.8+ ย ยทย Google Chrome (for login only)
โก Quick Start
pythonfrom py3pin.Pinterest import Pinterest pinterest = Pinterest( email='you@email.com', password='your_password', username='your_username', cred_root='cred_root' # cookies stored here, created automatically ) # Login once โ cookies are saved and reused automatically (~15 days) pinterest.login() # Pin an image pinterest.pin( board_id='123456789', image_url='https://example.com/image.jpg', title='My Pin', description='Pinned with py3-pinterest' )
๐ฌ Upload Pins
Image from local file
pythonpinterest.upload_pin( board_id='123456789', image_file='photo.jpg', title='My Pin', description='Uploaded with py3-pinterest', link='https://example.com' )
Video pin โจ
pythonpinterest.upload_video_pin( board_id='123456789', video_file='video.mov', title='My Video Pin', description='Video uploaded with py3-pinterest', link='https://example.com' )
๐ก Requires
ffmpegandffprobeon PATH. Or provideduration_ms,width,height, andcover_image_filemanually to skip the dependency.
Pin from URL
pythonpinterest.pin( board_id='123456789', image_url='https://example.com/image.jpg', title='Pin Title', description='Pin description' )
Repin
pythonpinterest.repin(board_id='board_id', pin_id='pin_id')
๐ Pin Management
pythonpinterest.load_pin(pin_id='pin_id') # Get full pin data pinterest.delete_pin(pin_id='pin_id') # Delete a pin pinterest.get_pinnable_images(url='...') # Get pinnable images from any website
๐ Boards
python# List boards boards = pinterest.boards(username='someone') # One page boards = pinterest.boards_all(username='someone') # All boards # Create & delete pinterest.create_board(name='My Board', description='A new board') pinterest.delete_board(board_id='board_id') # Board feed โ all pins in a board pins = pinterest.board_feed(board_id='board_id', reset_bookmark=True) # Recommendations ("More ideas") recs = pinterest.board_recommendations(board_id='board_id', reset_bookmark=True)
Board Sections
pythonpinterest.create_board_section(board_id='board_id', section_name='My Section') pinterest.delete_board_section(section_id='section_id') pinterest.get_board_sections(board_id='board_id') # Supports page_size up to 100 pinterest.get_section_pins(section_id='section_id') # Pin directly to a section pinterest.pin(board_id='board_id', section_id='section_id', image_url='...') pinterest.upload_pin(board_id='board_id', section_id='section_id', image_file='...')
๐ค Users
pythonpinterest.get_user_overview(username='someone') pinterest.get_user_pins(username='someone', reset_bookmark=True)
๐ฅ Follow / Unfollow
python# Users pinterest.follow_user(user_id='user_id') pinterest.unfollow_user(user_id='user_id') # Boards pinterest.follow_board(board_id='board_id') pinterest.unfollow_board(board_id='board_id') # Get following & followers (batched) following = pinterest.get_following(username='someone', reset_bookmark=True) followers = pinterest.get_user_followers(username='someone', reset_bookmark=True) # Get all at once all_following = pinterest.get_following_all(username='someone') all_followers = pinterest.get_user_followers_all(username='someone')
๐ Search
python# Scopes: pins, buyable_pins, my_pins, videos, boards results = pinterest.search(scope='pins', query='home decor', reset_bookmark=True)
Visual Search
pythonpin_data = pinterest.load_pin(pin_id='pin_id') results = pinterest.visual_search(pin_data, x=10, y=50, w=100, h=100)
Type-ahead
pythonpinterest.type_ahead(term='apple')
๐ฌ Comments
pythonpinterest.comment(pin_id='pin_id', text='Nice pin!') pinterest.delete_comment(pin_id='pin_id', comment_id='comment_id') pinterest.get_comments(pin_id='pin_id', reset_bookmark=True)
โ๏ธ Messages
pythonconversations = pinterest.get_conversations() messages = pinterest.load_conversation(conversation_id='conv_id') # Send text, pin, or both pinterest.send_message(conversation_id='conv_id', message='Hey!') pinterest.send_message(conversation_id='conv_id', pin_id='pin_id') pinterest.send_message(conversation_id='conv_id', pin_id='pin_id', message='Check this out')
๐ Home Feed
pythonpins = pinterest.home_feed(reset_bookmark=True)
๐ Pagination
Most list methods are batched โ they return one page per call. Loop until empty:
pythonall_pins = [] batch = pinterest.board_feed(board_id='board_id', reset_bookmark=True) while batch: all_pins += batch batch = pinterest.board_feed(board_id='board_id') print(f'Total: {len(all_pins)} pins')
Always pass
reset_bookmark=Trueon the first call to start fresh.
๐ Proxy Support
pythonproxies = {"http": "http://user:pass@proxy_ip:port"} pinterest = Pinterest( email='...', password='...', username='...', cred_root='cred_root', proxies=proxies ) pinterest.login(proxy='ip:port')
๐ Login & Session
pythonpinterest.login() # Headless Chrome pinterest.login(headless=False) # Visible browser (for debugging) pinterest.login(proxy='ip:port') # Through a proxy pinterest.login(lang='en') # Set browser language pinterest.logout()
Cookies persist to disk and are reused across runs. Re-login when you start seeing 401/403 errors (~every 15 days).
๐งฉ Working with Responses
All methods return the raw Pinterest response:
pythonresp = pinterest.upload_pin(board_id='...', image_file='photo.jpg', title='Test') data = resp.json() pin_id = data["resource_response"]["data"]["id"] board_id = data["resource_response"]["data"]["board"]["id"]
๐ Examples
Full working examples in the Examples/ directory:
| File | Description |
|---|---|
examples.py | ๐๏ธ Comprehensive overview of all features |
upload_examples.py | ๐ค Image and video upload |
board_sections_example.py | ๐ Board sections and section pins |
download_board_images.py | โฌ๏ธ Download all images from boards |
follow_examples.py | ๐ฅ Search, follow users and boards |
mass_board_invites.py | ๐จ Bulk board invites from search |
messages_example.py | โ๏ธ Conversations and messaging |
get_board_followers.py | ๐ค Get board followers |
๐ค Contributing
Found a bug or want to add a feature? Open an issue or submit a PR.
Thanks to all contributors:
@alglez, @anonymustard, @Ashad001, @bahrmichaelj, @CapofWeird, @edersonff, @elmissouri16, @erenalpt, @evezus, @fratamico, @Gmanicus, @imgVOID, @kruvatz, @magicaltoast, @marcosfelt, @mfhassan22, @Nviard, @RKuttruff, @VeemPees, @victorviro, @vladradishevsky, @vriadlee, @vtni, @yaonur
๐ Community Guides
- Get started with Pinterest automation โ MarTechWithMe
- Automated posting to Pinterest (Russian) โ Analitiq YouTube
<p align="center"> <b>MIT License</b> ยท Made with โค๏ธ by <a href="https://github.com/bstoilov">@bstoilov</a> </p>
Contributors
Showing top 12 contributors by commit count.
