karlicoss / pockexport

Export/access your Pocket data, including highlights!
Other
177 stars 14 forks source link
backup data-liberation export pocket takeout

+begin_src python :dir src :results drawer :exports results

import pockexport.export as E; return E.make_parser().prog

+end_src

+RESULTS:

:results: Export your personal Pocket data, including highlights as JSON. :end:

  1. Follow [[https://github.com/tapanpandita/pocket#oauth][these]] instructions to retrieve an API token using =consumer_key= you got on the previous step.

    You can use anything as =redirect_uri=, e.g. =https://example.com=. You should get =access_token= after that.

    You only need to do this step once, after that you can use =access_token= straightaway.

+begin_src python :dir src :results drawer :exports results

import pockexport.export as E; return E.make_parser().epilog

+end_src

+RESULTS:

:results:

Usage:

Recommended: create =secrets.py= keeping your api parameters, e.g.:

: consumer_key = "CONSUMER_KEY" : access_token = "ACCESS_TOKEN"

After that, use:

: python3 -m pockexport.export --secrets /path/to/secrets.py

That way you type less and have control over where you keep your plaintext secrets.

Alternatively, you can pass parameters directly, e.g.

: python3 -m pockexport.export --consumer_key --access_token

However, this is verbose and prone to leaking your keys/tokens/passwords in shell history.

You can also import ~pockexport.export~ as a module and call ~get_json~ function directly to get raw JSON.

I highly recommend checking exported files at least once just to make sure they contain everything you expect from your export. If not, please feel free to ask or raise an issue!

:end:

I highly recommend to back up regularly and keep old exports. Easy way to achieve it is command like this:

: python3 -m pockexport.export --secrets /path/to/secrets.py >"export-$(date -I).json"

Or, you can use [[https://github.com/karlicoss/arctee][arctee]] that automates this.

TODO link to exports post?

TODO could add this to epilog of export script if api is restrictive?

+begin_src python :dir src :results drawer :exports results

import ghexport.exporthelpers.dal_helper as D; return D.make_parser().epilog

+end_src

+RESULTS:

:results:

You can use =ghexport.dal= (stands for "Data Access/Abstraction Layer") to access your exported data, even offline. I elaborate on motivation behind it [[https://beepb00p.xyz/exports.html#dal][here]].

:end: