Download and parse ancient Chinese book resources from digital libraries
Project description
Bookget
古籍数字资源下载与管理工具,支持从 20+ 个数字图书馆网站下载古籍图片和文字资源(包括 IIIF 2.x / 3.0 manifest)。全异步架构,插件式适配器设计。
支持的网站
中国大陆
| 网站 | 域名 | 图片 | 文字 | 搜索 |
|---|---|---|---|---|
| 中华古籍智慧化服务平台 | guji.nlc.cn |
✓ | ✓ | |
| 识典古籍 | shidianguji.com |
✓ | ✓ | ✓ |
| 中国哲学书电子化计划 | ctext.org |
✓ | ✓ |
日本 / 台湾
| 网站 | 域名 | 图片 | 文字 |
|---|---|---|---|
| 国立国会図書館 (NDL) | dl.ndl.go.jp |
✓ | |
| 京都大学贵重资料数字档案 (RMDA) | rmda.kulib.kyoto-u.ac.jp |
✓ | |
| 漢籍全文資料庫 | hanchi.ihp.sinica.edu.tw |
✓ | |
| 臺灣國家圖書館 | rbook.ncl.edu.tw |
✓ | |
| 臺灣故宮博物院 | digitalarchive.npm.gov.tw |
✓ |
欧美图书馆
| 网站 | 域名 | 图片 |
|---|---|---|
| 哈佛大学图书馆 | curiosity.lib.harvard.edu |
✓ |
| 普林斯顿大学图书馆 | dpul.princeton.edu |
✓ |
| 斯坦福大学图书馆 | searchworks.stanford.edu |
✓ |
| 柏克莱加州大学东亚图书馆 | digicoll.lib.berkeley.edu |
✓ |
| 法国国家图书馆 (BnF) | gallica.bnf.fr |
✓ |
| 大英图书馆 | bl.uk |
✓ |
| 巴伐利亚州立图书馆 (BSB) | digitale-sammlungen.de |
✓ |
通用
| 网站 | 域名 | 图片 | 搜索 |
|---|---|---|---|
| Wikimedia Commons | commons.wikimedia.org |
✓ | ✓ |
| 维基文库 | zh.wikisource.org |
✓ | |
| Internet Archive | archive.org |
✓ | |
| 通用 IIIF | 任意 IIIF Manifest URL | ✓ |
安装
方式一:下载可执行文件(推荐)
前往 Releases 下载对应平台的文件,无需安装 Python:
| 文件 | 说明 |
|---|---|
bookget-cli-windows.exe |
Windows 命令行工具,双击运行 |
bookget-cli-macos |
macOS 命令行工具 |
bookget-ui-windows.exe |
Windows 图形界面,双击打开浏览器操作 |
bookget-ui-macos |
macOS 图形界面 |
macOS 用户首次运行需赋予执行权限:
chmod +x bookget-cli-macos
方式二:pip 安装
需要 Python 3.10 或更高版本。
pip install bookget
如需下载识典古籍(需要浏览器自动化绕过反爬):
pip install "bookget[browser]"
playwright install chromium
使用方法
图形界面(bookget-ui)
双击运行 bookget-ui,自动打开浏览器,在网页中操作即可。
或通过命令行启动:
bookget serve
交互模式(bookget-cli)
直接运行 bookget(或双击 bookget-cli),按提示逐步操作:
=======================================================
bookget — 古籍下载工具
=======================================================
请输入书目 URL(输入 q 退出): https://www.shidianguji.com/book/v3/1001
✓ 已识别站点:识典古籍
下载目录 [C:\Users\xxx\Downloads\bookget]:
并行数量 [3]:
正在探索书目结构……
标题:周易
节点:12 已完成:0
开始下载所有节点?[Y/n]:
下载完成后自动回到输入界面,可继续下载其他古籍。按 q 或 Ctrl+C 退出。
命令行模式
下载古籍
# 基本下载
bookget download "URL" -o ./output
# 增量下载(支持断点续传)
bookget download "URL" -o ./output --incremental --concurrency 3
# 只下载图片,不下载文字
bookget download "URL" -o ./output --no-text
# 只下载文字
bookget download "URL" -o ./output --no-images
结构发现与分步下载
# 发现书目结构(不下载)
bookget discover "URL" -o ./output
# 展开某个节点
bookget expand "URL" -o ./output --node NODE_ID
搜索与匹配
# 在指定站点搜索书名
bookget search --site ctext --query "周易"
# 精确匹配书名和作者
bookget match --site shidianguji --title "周易" --authors "孔颖达"
其他命令
# 获取书籍元数据
bookget metadata "URL"
# 查看所有支持的网站
bookget sites --list
# 检查某个网址是否支持
bookget sites --check "URL"
常用选项
| 选项 | 说明 |
|---|---|
-o, --output DIR |
下载保存目录 |
--incremental |
增量下载,支持断点续传 |
--concurrency N |
同时下载数量(默认 1) |
--no-images |
跳过图片 |
--no-text |
跳过文字 |
--section NODE_ID |
只下载指定章节 |
--json |
以 JSON 格式输出结果 |
-q, --quiet |
安静模式,减少输出 |
配置
可通过环境变量调整默认行为:
| 变量 | 说明 | 默认值 |
|---|---|---|
GUJI_OUTPUT_DIR |
下载目录 | ./downloads |
GUJI_CONCURRENT_DOWNLOADS |
同时下载数量 | 4 |
GUJI_DEBUG |
调试模式 | false |
也可以用配置文件:
bookget --config config.json download "URL"
从源码构建
如果你想自行构建可执行文件:
# 克隆仓库
git clone https://github.com/open-guji/bookget-py.git
cd bookget-py
# 安装依赖
pip install -e ".[dev]"
pip install pyinstaller
# 安装前端依赖
cd ui && npm install && cd ..
# 构建两个可执行文件
python packaging/build.py
# 或只构建其中一个
python packaging/build.py cli # 只构建 bookget-cli
python packaging/build.py ui # 只构建 bookget-ui(会自动构建前端)
构建产物在 dist/ 目录下。
许可证
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bookget-0.3.2.tar.gz.
File metadata
- Download URL: bookget-0.3.2.tar.gz
- Upload date:
- Size: 144.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c480abf1912e28e14d7a8cd45b20a2261cfa4daab9915c6e3d2bf1688667963
|
|
| MD5 |
d1091166526915c747b604169a999a3e
|
|
| BLAKE2b-256 |
b36a03dcba5dcdcf620f7b8aa1f292bd6ddac6edec98ecfa2d663065ccc3457a
|
Provenance
The following attestation bundles were made for bookget-0.3.2.tar.gz:
Publisher:
release.yml on open-guji/bookget-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bookget-0.3.2.tar.gz -
Subject digest:
5c480abf1912e28e14d7a8cd45b20a2261cfa4daab9915c6e3d2bf1688667963 - Sigstore transparency entry: 1392545895
- Sigstore integration time:
-
Permalink:
open-guji/bookget-py@79dda3398ba93353420caea12b6739d15bdc5155 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/open-guji
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@79dda3398ba93353420caea12b6739d15bdc5155 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bookget-0.3.2-py3-none-any.whl.
File metadata
- Download URL: bookget-0.3.2-py3-none-any.whl
- Upload date:
- Size: 145.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5abfb066a1f445ce8529c00a80b40e053a17bbf925d60b9d68bf894a647c9ec
|
|
| MD5 |
4c13d161320c837a81aca03a5d77133c
|
|
| BLAKE2b-256 |
0355f68a11714d090a7bc5a35b8774ccc246b1cffec6b642f9537b007dfafb56
|
Provenance
The following attestation bundles were made for bookget-0.3.2-py3-none-any.whl:
Publisher:
release.yml on open-guji/bookget-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bookget-0.3.2-py3-none-any.whl -
Subject digest:
e5abfb066a1f445ce8529c00a80b40e053a17bbf925d60b9d68bf894a647c9ec - Sigstore transparency entry: 1392545900
- Sigstore integration time:
-
Permalink:
open-guji/bookget-py@79dda3398ba93353420caea12b6739d15bdc5155 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/open-guji
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@79dda3398ba93353420caea12b6739d15bdc5155 -
Trigger Event:
push
-
Statement type: