A command line interface to Pocket
- Open https://getpocket.com/developer/apps/new in a browser that's logged in to your Pocket account
- Fill out the form:
- Give your application a unique name
- Grant all permissions: Add, Modify, and Retrieve
- For platform, choose "Desktop (other)"
- Accept the Terms of Service and click "Create Application"
- Find your application's
consumer_keylisted on https://getpocket.com/developer/apps/
Run this:
curl \
-d "consumer_key=$consumer_key" \
-d "redirect_uri=pockesh:auth" \
https://getpocket.com/v3/oauth/requestThe output should read something like this:
code=abcdef01-2345-6789-abcd-ef0123
Take the value of code above and substitute it for $code in this URL:
https://getpocket.com/auth/authorize?request_token=$code&redirect_uri=https://github.com/drench/pockesh
Open the URL in a browser that is logged in to your Pocket account. Click the "Authorize" button and you should get redirected back to this project's Github page.
Run this command to complete the authorization process, substituting your
consumer_key and code values:
curl \
-d "consumer_key=$consumer_key" \
-d "code=$code" \
https://getpocket.com/v3/oauth/authorizeThe output should read something like this:
access_token=abcdef01-2345-6789-abcd-ef0123&username=yourname%40example.com
Create a file in your home directory called .pocketrc and save your codes in
it using this format:
consumer_key=01234-567890abcdef0123456789ab
access_token=abcdef01-2345-6789-abcd-ef0123
Put the pocket-* files somewhere in your $PATH. I like ~/bin.
Add a URL and tag it with shell:
pocket-add --url https://github.com/drench/pockesh --tags shellDelete an item:
pocket-modify --action delete --item_id 1455241157Get the URLs of all items tagged longreads, sorted by most recently added first:
pocket-get --tag longreads --sort-newest-first | jq '.list | .[] | .resolved_url'Flag an item as a "favorite":
pocket-modify --action favorite --item_id 145416741