A CLI for Pocket using pocket-api and influenced by pocket-cli but more specific to my use case ๐
For accessing your Pocket items you must obtain a free API access. James Mackenzie provides an excellent guide.
With your credentials create a file named conf.yaml
with the following content next to the __main__.py
:
credentials:
consumer_key: '<your-key>'
access_token: '<your-token>'
- Retrieve all Pocket entries from your account
- Store
url
,title
,tags
, andtime_added
in a local sqlite3 database - Handle and mark missing fields (e.g. missing title)
- Print simple statistics about tags
- Filter and output stored entries as ascii table or parsable
Over the years the tags of my Pocket entries increased and need to be standardized. Therefore, the goal is to clean up Pocket entries, especially their tag, with the help of this tool. Of course the web frontend offers filtering by tag but in my opinion a CLI tool is more powerful.
$ python main.py
Usage: main.py [OPTIONS] COMMAND [ARGS]...
CLI for interacting with the Pocket API
Options:
--help Show this message and exit.
Commands:
filter Filter and list entries
tags Prints tags and their figures
update Updates/recreates the database containing all information
$ python main.py update --help
Usage: main.py update [OPTIONS]
Updates/recreates the database containing all information
Options:
--count INTEGER number of entries to fetch
--path TEXT path to sqlite3 file
--help Show this message and exit.
python __main__.py filter --help
Usage: __main__.py filter [OPTIONS] [KEYWORDS]...
Filter and list entries
Options:
--path TEXT path to sqlite3 file
--width INTEGER column width of url and title
--col TEXT Which column (url, title, tags, note) to search
--count / --no-count Prints number of items
--parsable / --no-parsable Output no asci table
--help Show this message and exit.
$ python main.py tags --help
Usage: main.py tags [OPTIONS]
Prints tags and their figures
Options:
--path TEXT path to sqlite3 file
--sort / --no-sort sort by tag numbers
--help Show this message and exit.