You've added a lot of articles into Pocket and forgot to read them? Well, we tag articles that are 5 minutes long so you read them while taking your next dump.
This is bad, but it should work. First you need this requirements:
- PHP 5.4.0 or greater (
php
as the command will be inferred from now on). - Composer installed (
composer.phar
as the command will be inferred from now on). - Git installed (
git
will be inferred).
$ git clone git@github.com:augustohp/reading-dump.git
$ cd reading-dump
$ composer.phar install
$ export POCKET_APP_CONSUMER_KEY="68036-0687e76e71d1c40d0fa1cca5"
$ php -S 127.0.0.1:8080 -t www/
You should now be able to create an access token opening this page
in your browser. Make sure you export
your access token in the
terminal you are going to use. The mechanics are separated into
different commands so it is easier to refactor them into reusable
components in the future - or just because I've not put any thoughts
whatsoever into making them:
- Display a list of unread articles, one per line, displaying
item-id
,since
andword count
. - Filter articles that are 5 minute long from the list.
- Tag articles by their
article-id
asreading-dump
.
This looks like something like this, you can cron that:
$ export POCKET_APP_ACCESS_TOKEN="the token generated by previous page"
$ php reading-dump.php pocket-retrieve --limit 10 --since 1497812212 | \
php reading-dump.php filter-reading-time --less-than-min 5 |
php reading-dump.php pocket-tag --tag "reading-dump"
A list of ideas that might be interesting:
- Make comments accept streams and direct arguments at the same time.
- Retrieve the access token through console (no web page on our end needed).
- Maintain a
$HOME/.reading-dump.ini
file with access token and other useful states. - Implement a pager so
limit
andoffset
can be inferred. - Offer a single command
reading-dump.phar cron-daily
. - Make it beautiful (E.g: allow different sources and outputs, send to kindle).