Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Unofficial Pinterest API implemented in python 3 that can do all Pinterest tasks like comment, pin, repin, follow, unfollow, and more.
It is implemented by directly calling the pinterest servers, mimicking an actual browser, so you don't need pinterest API key.
If you see any issues, or find bugs feel free to report them here on the github repo.
Get started with pinterest automation
Automated posting to Pinterest (in Russian)
pip install py3-pinterest
pinterest = Pinterest(email='your email goes here', password='password goes here', username='look in pinterest url', cred_root='cred root dir')
cred_root is the dir (automatically created if missing) that will store some cookies and sessions, so you don't need to login before each request. Make sure you specify a path with read/write permissions.
Proxies example:
proxies = {"http":"http://username:password@proxy_ip:proxy_port"}
Pinterest(email='emai', password='pass', username='name', cred_root='cred_root', proxies=proxies)
Login will store auth cookies for later use. These cookies are usually valid for ~15 days, then you will start getting 403 and 401 errors, which means you need to call login again.
Login is required to permit actions to the Pinterest servers. Login will store auth cookies for later use. These cookies are usually valid for ~15 days, then you will start getting 403 and 401 errors, which means you need to call login again.
pinterest.login()
pinterest.logout()
You can load profile for currently logged in user or any user specified by username.
user_profile = pinterest.get_user_overview()
boards = pinterest.boards(username='username')
pins = pinterest.board_feed(board_id=board_id)
If username is left blank, current logged in user will be used.
pinterest.delete_pin(pin_id='pin_id')
pinterest.repin(board_id='board_id', pin_id='pin_id')
All functions return the post/get data from the request. If you dig a little deeper by going myrequest.content you get the actual HTML response, which can then be turned into a dict by using JSON.
Example:
import json
pin_response = upload_pin(board_id='',
image_path='test.png',
description='TESTING PIN FUNCTIONALITY WITH ID FETCHING',
title='Foobar Barfood',
section_id=None,
link='')
response_data = json.loads(pin_response.content)
Some helpful notes on the response: Everything is stored inside the "resource_response" key. You can use that and grab all sorts of data like so:
# This is how you would access this information when creating a pin
id = response_data["resource_response"]["data"]["id"]
board_id = response_data["resource_response"]["data"]["board"]["id"]
section_id = response_data["resource_response"]["data"]["section"]["id"]
pinner_username = response_data["resource_response"]["data"]["pinner"]["username"]
pinner_id = response_data["resource_response"]["data"]["pinner"]["id"]
# If you wanted to access this information in a different circumstance,
# keep in mind that whatever you are creating should be the first level under "data"
# I.e, I created a board, and I want to get the board ID. It would now be:
board_id = response_data["resource_response"]["data"]["id"]
A pinterest feature they use to pin from websites
pinterest.get_pinnable_images(url='https://www.tumblr.com/search/food')
Pin image by web url:
pinterest.pin(board_id=board_id, image_url=image_url, description=description, title=title)
Pin image from local file:
pinterest.upload_pin(board_id=board_id, section_id=section_id, image_file=image_path, description=description, title=title, link=link)
home_feed_batch = pinterest.home_feed()
rec_batch = pinterest.board_recommendations(board_id=board_id)
pinterest.load_pin(pin_id='pin_id')
pinterest.create_board_section(board_id=board_id, section_name=section_name)
pinterest.delete_board_section(section_id=section_id)
pinterest.get_board_sections(board_id=board_id)
You can also pin and repin to sections.
pinterest.follow_user(user_id='target_user_id', username='target_username')
Follow limit is 300 per day, after that they might place you on a watch list
pinterest.unfollow_user(user_id='target_user_id', username='target_username')
Unfollow limit is 350 per day, after that they might place you on a watch list
following_batch = pinterest.get_following(username='some_user')
If username is not provided current user will be used
followers_batch=pinterest.get_user_followers(username='some_user')
If username is not provided current user will be used
pinterest.follow_board(board_id=board_id)
pinterest.unfollow_board(board_id=board_id)
search_batch = pinterest.search(scope='boards', query='food')
Current pinterest scopes are: pins, buyable_pins, my_pins, videos, boards
pin_data = pinterest.load_pin(pin_id='pin_id')
search_batch = pinterest.visual_search(pin_data, x=10, y=50, w=100, h=100)
pinterest.invite(board_id=board_id, user_id=target_user_id)
pinterest.delete_invite(board_id=board_id, invited_user_id=target_user_id)
invites_batch = pinterest.get_board_invites(board_id=board_id)
pinterest.comment(pin_id=pin_id, text=comment_text)
pinterest.delete_comment(pin_id=pin_id, comment_id=comment_id)
pinterest.get_comments(pin_id='pin_id')
pinterest.send_message(conversation_id=conversation_id, pin_id="(pin_id)", message="hey")
pinterest.type_ahead(term='apple')
FAQs
Unofficial pinterest api implemented in python 3
We found that py3-pinterest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.