Skip to main content

A toolkit for downloading and processing novels.

Project description

novel-downloader

PyPI Python CI Hits-of-Code

中文 | English

异步、可扩展的小说下载与处理工具包。

支持断点续爬、多格式导出、文本处理流水线, 并提供 CLI 与可选 Web 界面。

文档: 项目文档

运行要求: Python 3.11+ (开发环境: Python 3.13)


功能特性

  • 异步与高性能下载
  • 可恢复下载 (断点续爬)
  • 可插拔 HTTP 后端: aiohttp / httpx / curl_cffi
  • 多格式导出: TXT / EPUB / HTML
  • 文本处理流水线: 去广告、繁简转换、自动翻译等
  • 图片章节与混淆章节支持 (可选)
  • 插件系统: 可扩展站点解析器、导出器、Pipeline 等
  • CLI 与可选 Web GUI

完整功能列表见: 功能总览


安装与更新

使用 pip 安装最新稳定版本:

pip install -U novel-downloader-spiritlhl

PyPI 发行包名为 novel-downloader-spiritlhl, 安装后的导入名与 CLI 命令保持不变, 仍然使用 novel_downloadernovel-clinovel-web

如需启用 Web GUI:

pip install novel-downloader-spiritlhl[web-ui]

如需启用其它可选功能 (Web UI、图片转文字、额外后端等), 请参见: 安装指南


快速开始 (CLI)

# 下载一本小说
novel-cli download https://www.example.com/book/123/

# 使用站点 + 书籍 ID
novel-cli download --site n23qb 12282

更多示例见: CLI 使用示例

编程接口 (Programmatic API)

import asyncio
from novel_downloader.plugins import registrar
from novel_downloader.schemas import BookConfig, ClientConfig

async def main() -> None:
    site = "n23qb"

    # 指定书籍 ID
    book = BookConfig(book_id="12282")

    # 创建客户端
    cfg = ClientConfig(request_interval=0.5)
    client = registrar.get_client(site, cfg)

    # 在异步上下文中执行下载
    async with client:
        await client.download_book(book)

    # 下载完成后执行导出操作
    client.export_book(book, formats=["txt", "epub"])

if __name__ == "__main__":
    asyncio.run(main())

更多示例见: API 示例


贡献与开发

git clone https://github.com/spiritLHLS/novel-downloader.git
cd novel-downloader

# 可选: 为多语言支持编译翻译文件
# pip install babel
# pybabel compile -d src/novel_downloader/locales

pip install .
# 或安装带可选功能:
# pip install .[all]
# pip install -e .[dev,all]

欢迎提交 Issue / PR。


致谢

本仓库基于上游项目 saudadez21/novel-downloader 演化维护, 在此向原项目及历史贡献者致谢。


注意事项

  • 站点结构变更: 若目标站点页面结构更新或章节抓取异常, 欢迎提 Issue 或提交 PR
  • 登录支持范围: 登录功能受站点策略与接口限制, 部分场景需要手动配置 Cookie 或进行账号绑定
  • 请求频率: 请合理设置抓取间隔, 避免触发风控或导致 IP 限制

项目说明

  • 本项目仅供学习和研究使用, 不得用于任何商业或违法用途
  • 请遵守目标网站的 robots.txt 及相关法律法规
  • 使用本项目产生的任何法律责任由使用者自行承担, 作者不承担相关责任

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

novel_downloader_spiritlhl-3.1.1.tar.gz (747.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

novel_downloader_spiritlhl-3.1.1-py3-none-any.whl (985.1 kB view details)

Uploaded Python 3

File details

Details for the file novel_downloader_spiritlhl-3.1.1.tar.gz.

File metadata

File hashes

Hashes for novel_downloader_spiritlhl-3.1.1.tar.gz
Algorithm Hash digest
SHA256 dfddf32ca2a2364e41a1dcb5d100825f00f3092486553aab4f0ece842ef0e02d
MD5 5814224d077f9096aeedbf28a8257a25
BLAKE2b-256 bbf443c4eb726916479679aaa86cd6223a672579032d28833e45c18e89d12075

See more details on using hashes here.

Provenance

The following attestation bundles were made for novel_downloader_spiritlhl-3.1.1.tar.gz:

Publisher: release.yml on spiritLHLS/novel-downloader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file novel_downloader_spiritlhl-3.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for novel_downloader_spiritlhl-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a8a492be0bdefb5ad1cc896261214b80a357376585c758979d11802a8047c3d0
MD5 9bc93bd6a9173479cbeb2828583fdcc5
BLAKE2b-256 c93e116d030d62f299a2d106af6a14e45945903561c574eb50eff5b98ab27c89

See more details on using hashes here.

Provenance

The following attestation bundles were made for novel_downloader_spiritlhl-3.1.1-py3-none-any.whl:

Publisher: release.yml on spiritLHLS/novel-downloader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page