A Python script to keep your followers updated about your reading-list!
It picks one of the articles from the linked Pocket account which is tagged as twitter for example and tweets a status update with it - then archives it.
I find the app called Pocket immensely useful to maintain an ever-growing reading list of interesting articles that I could access later anywhere on any platform. I also have an account on Twitter where I regularly post interesting articles relevant to my line of work. However in order to share items saved in Pocket on Twitter, a checkbox is ought to be checked each time - also, we may save items to our Pocket that wouldn't be relevant to our Twitter at all.
-
Create an App on Twitter Developers here, and make sure you have both Consumer API keys and a read-write Access token & access token secret.
-
Create an Application on Pocket here. Doesn't need to be public.
-
Get an Access Token for Pocket based on your Consumer Key - this is needed due to Pocket's Authentication API using OAuth 2.0 as detailed here. There is also an on-line tool for this task here but I haven't tried it yet.
-
Add the tokens to
config.py
. -
Install
pocket-api
andtwitter
with:pip install pocket-api twitter
-
Run
pocket2tweet.py
each time when you'd like to update your followerspython pocket2tweet.py
. -
You may obviously want to do the last automatically from cron, or set up a scheduled task for it on Windows.
There are three optional command-line parameters:
--elapsed-hours
: how many hours to wait after your most recent tweet - exiting otherwise. Defaults to 24.--article-tag
: which tag to look for in your Pocket. Default is twitter.--random-delay
: a random delay of at most the specified minutes before doing anything
This project is not endorsed by the vendors of Pocket and Twitter in any way and use it only at your own responsibility.
- Only archiving the Pocket item if twitter is the only single tag - otherwise only removing it.