Get Pocket to send to mastodon
IPFS
Pocket operation
- pip install pocket-api
- https://pypi.org/project/pocket-api/
Mainly to get CONSUMER KEY and access token
- Get CONSUMER KEY
- https://getpocket.com/developer/apps/new
- Set the corresponding name and permissions, and then get the CONSUMER KEY, which will be used later.
- oauth get code
- https://getpocket.com/v3/oauth/request , post request
consumer_key=<consumer_key> redirect_uri=<app_name>:authorizationFinished
- Return something like: code=
- Activate license
- Browser input: https://getpocket.com/auth/authorize?request_token=a546cd87-2546-86ea-b213-3d5de4&redirect_uri= <app_name>:authorizationFinished
- get access_token
- post request: https://getpocket.com/v3/oauth/authorize
consumer_key= code=
- return access_token=
Reference https://getpocket.com/developer/docs/v3/retrieve
p = Pocket(consumer_key='',access_token='') p.retrieve(offset=0,count=5,tag='hk',since=test_timestamp) # Read resolved_url and resolved_title according to the return value
send message to mastodon
- Get the corresponding parameters: application ID, application key, your access token
- pip install mastodon.py
- https://mastodonpy.readthedocs.io/en/stable/
mastodon = Mastodon( client_id='', client_secret='', access_token = '', api_base_url = 'https://domain' ) mastodon.toot(str) # str is the text to send, other parameters refer to docs
Timed execution
Executed at 00:00 every day
0 10 * * * python /home/youScript.py
refer to
https://getpocket.com/developer/docs/v3/retrieve
Pocket API + Python study notes
Share your own reading list with Pocket API
Mastodon | Weibo forwarded to Mastodon bot
https://mastodonpy.readthedocs.io/en/stable/
Automatically get Pocket and send to mastodon
Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!
- Author
- More