Skip to main content

ituring-fetch

把图灵社区已购电子书扒下来,转成 epub/pdf/html。

安装

git clone <repo>
cd ituring_fetch
uv sync
playwright install chromium   # 或者用系统自带的 Chrome

依赖:Python 3.11+、pandoc(epub 格式需要)、Chrome/Chromium。

使用

# 登录(会弹出浏览器窗口)
uv run ituring-fetch login

# 看看登录没
uv run ituring-fetch status

# 列出已购电子书
uv run ituring-fetch list

# 抓取一本书
uv run ituring-fetch fetch 1143 --type=epub
uv run ituring-fetch fetch 1143 --type=pdf
uv run ituring-fetch fetch 1143 --type=html

# 指定输出文件名
uv run ituring-fetch fetch 1143 --type=pdf -o mybook.pdf

# 登出
uv run ituring-fetch logout

list 输出的第一列就是书籍 ID。

调试

出问题时设个环境变量看详细日志:

ITURING_DEBUG=1 uv run ituring-fetch fetch 1143 --type=pdf

会往 stderr 打请求/响应细节。

原理

登录时用 Playwright 打开浏览器,你手动登录后,程序从 localStorage 里取出 access token,跟 cookie 一起存到 ~/.ituring/credentials.json。

后续操作:

  • list 和书籍信息直接调 api.ituring.com.cn 的接口,带 Bearer token
  • 章节内容用 Playwright headless 渲染页面,抽 .article-content 的 HTML
  • 合并所有章节,pandoc 转 epub,Playwright 内置 PDF 引擎出 pdf

Metadata

Release files for ituring-fetch 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ituring-fetch 0.1.1
File Size Uploaded Provenance Actions
ituring_fetch-0.1.1.tar.gz 63.0 kB Without provenance Details for ituring_fetch-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ituring-fetch 0.1.1
File Interpreter ABI Platform Actions
ituring_fetch-0.1.1-py3-none-any.whl Python 3 none any Details for ituring_fetch-0.1.1-py3-none-any.whl

Total release size: 75.7 kB

Release files / ituring_fetch-0.1.1.tar.gz

Download URL ituring_fetch-0.1.1.tar.gz
Size 63.0 kB
Tags Source
SHA-256 checksum
How to use checksums
79a4cbe1d961f7a19d184eb406e3790b9380fe3e7eec738369943e95d7363572
BLAKE2b-256 checksum
How to use checksums
9644780341e17844e3cf00aafb0eb05c62e8c1a67897524fb4176a8b1b214373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ituring_fetch-0.1.1-py3-none-any.whl

Download URL ituring_fetch-0.1.1-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
296b724eb88bb64215ec05f9c8827b36032ec44e25cd119cffa7871e1115000e
BLAKE2b-256 checksum
How to use checksums
f279962135b3f681e9530fb4b9d1d4e667fc061d7eb4117ff5c68cf5831cbf86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ituring-fetch 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page