Other

项目介绍

karlicoss/pockexport 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 Other 许可证,目前获得 202 个 Star、16 次 Fork。

仓库全名
karlicoss/pockexport
开源许可证
Other
Star 数
202
Fork 数
16
未关闭 Issue
1

README 摘要

Export your personal Pocket data, including highlights as JSON. Setting up 1. The easiest way is pip3 install --user git+https://github.com/karlicoss/pockexport. Alternatively, clone the repository and run pip3 install --editable .. 2. To use the API you need a consumerkey. You’ve got three alternatives here: Lazy way: just use 78809-9423d8c743a58f62b23ee85c as the consumer key. This seems to be the hardcoded key…

完整内容见 GitHub 原始 README 或本页 。

常见问题

pockexport 用什么语言开发?

主要使用 Python 编写,采用 Other 许可证,目前有 202 个 Star。

pockexport 可以免费商用吗?

仓库标注的许可证为 Other,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 pockexport 的源码?

可以直接克隆仓库:git clone https://github.com/karlicoss/pockexport.git,默认分支为 master;安装与运行步骤见仓库 README。

pockexport 最近还在维护吗?

仓库最近一次更新为 1 周前,当前有 1 个未关闭 Issue;Star 数为 202,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Export/access your Pocket data, including highlights!

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
239
价值分
126
活跃状态
活跃

README

Export your personal Pocket data, including highlights as JSON.

Setting up

  1. The easiest way is pip3 install --user git+https://github.com/karlicoss/pockexport.

    Alternatively, clone the repository and run pip3 install --editable ..

  2. To use the API you need a consumer_key. You’ve got three alternatives here:

    • Lazy way: just use 78809-9423d8c743a58f62b23ee85c as the consumer key.

      This seems to be the hardcoded key Pocket uses for their web app. It’s public and shared between all users, so there is no problem with sharing it here.

    • Chaotic way: get API key directly from web app.

      The benefit of doing this is that the API gives away more data, including highlights (unlike the consumer key you get by registering your own app).

      Note that this will likely just give you the same key as above, although I’m not 100% sure. E.g. some people reported this method didn’t work for them, unlike just simply using the hardcoded key.

      To do that, go to Pocket web app, open Network Monitor from your browser dev tools (e.g. firefox), and refresh the page.

      You can find consumer_key in ‘Request URL’ for any of json requests.

      If you still struggle with these steps, I recommend a comprehensive tutorial.

      This is sort of hacky, but only way I know of extracting highlights. I tried registering apps targeting other platforms (e.g. web/extension), but still nothing, seems that Pocket’s consumer key is hardcoded in backend code or something.

    • Lawful good way: register an app here with ‘Retrieve’ permissions and type ‘Desktop (other)’.

      Then open app in the list and take note of consumer_key.

  3. Follow 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.

Exporting

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 <consumer_key> --access_token <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 they don’t, please feel free to ask or raise an issue!

Limitations

I’m not aware of any limits on number of old entries you can retrieve through API; it doesn’t even have pagination. If you know of them, please let me know or open PR!

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 arctee that automates this.

Example output

See ./example-output.json, it’s got some example data you might find in your data export.

Using data

You can use this DAL (Data Access/Abstraction Layer) module to access your exported data, even offline. I elaborate on motivation behind it here.

  • the main use case is importing it as a Python module for programmatic access to your data.

    You can find some inspiration in my. package that I’m using as an API to all my personal data.

  • to test it against your export, simply run: python3 -m pockexport.dal /path/to/export

  • you can also try it interactively in an IPython shell: python3 -m pockexport.dal /path/to/export --interactive

Updating README

This README is generated from a ‘literate’ Quarto README.qmd via the following command:

tox -e quarto

If you want to correct something, feel free to simply update README.md though, I can reconcile the changes next time I regenerate it.

评论

暂无评论