Metadata-Version: 2.4
Name: novel-downloader-spiritlhl
Version: 3.1.1
Summary: A toolkit for downloading and processing novels.
Author: spiritlhl
License: MIT License
        
        Copyright (c) 2025 Saudade Z
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/spiritLHLS/novel-downloader
Project-URL: Documentation, https://github.com/spiritLHLS/novel-downloader/blob/main/docs/index.md
Project-URL: Source, https://github.com/spiritLHLS/novel-downloader
Project-URL: Issues, https://github.com/spiritLHLS/novel-downloader/issues
Keywords: novel,web novel,light novel,crawler,scraper,ebook,epub
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: Chinese (Simplified)
Classifier: Natural Language :: Chinese (Traditional)
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rich
Requires-Dist: requests
Requires-Dist: pycryptodome
Requires-Dist: aiohttp
Requires-Dist: lxml
Requires-Dist: platformdirs
Provides-Extra: web-ui
Requires-Dist: nicegui; extra == "web-ui"
Provides-Extra: image-utils
Requires-Dist: brotli; extra == "image-utils"
Requires-Dist: numpy; extra == "image-utils"
Requires-Dist: fonttools; extra == "image-utils"
Requires-Dist: pillow; extra == "image-utils"
Provides-Extra: httpx
Requires-Dist: httpx[http2]; extra == "httpx"
Provides-Extra: curl-cffi
Requires-Dist: curl_cffi; extra == "curl-cffi"
Provides-Extra: all-backends
Requires-Dist: httpx[http2]; extra == "all-backends"
Requires-Dist: curl_cffi; extra == "all-backends"
Provides-Extra: all
Requires-Dist: nicegui; extra == "all"
Requires-Dist: brotli; extra == "all"
Requires-Dist: numpy; extra == "all"
Requires-Dist: fonttools; extra == "all"
Requires-Dist: pillow; extra == "all"
Requires-Dist: httpx[http2]; extra == "all"
Requires-Dist: curl_cffi; extra == "all"
Provides-Extra: docs
Requires-Dist: mkdocs-material; extra == "docs"
Requires-Dist: mkdocstrings; extra == "docs"
Requires-Dist: mkdocstrings-python; extra == "docs"
Provides-Extra: tests
Requires-Dist: brotli; extra == "tests"
Requires-Dist: numpy; extra == "tests"
Requires-Dist: fonttools; extra == "tests"
Requires-Dist: pillow; extra == "tests"
Requires-Dist: pytest; extra == "tests"
Requires-Dist: pytest-asyncio; extra == "tests"
Requires-Dist: pytest-aiohttp; extra == "tests"
Requires-Dist: pytest-cov; extra == "tests"
Requires-Dist: pytest-mock; extra == "tests"
Requires-Dist: types-requests; extra == "tests"
Requires-Dist: types-lxml; extra == "tests"
Provides-Extra: ci
Requires-Dist: brotli; extra == "ci"
Requires-Dist: numpy; extra == "ci"
Requires-Dist: fonttools; extra == "ci"
Requires-Dist: pillow; extra == "ci"
Requires-Dist: curl_cffi; extra == "ci"
Requires-Dist: httpx[http2]; extra == "ci"
Requires-Dist: pytest; extra == "ci"
Requires-Dist: pytest-asyncio; extra == "ci"
Requires-Dist: pytest-aiohttp; extra == "ci"
Requires-Dist: pytest-cov; extra == "ci"
Requires-Dist: pytest-mock; extra == "ci"
Requires-Dist: types-requests; extra == "ci"
Requires-Dist: types-lxml; extra == "ci"
Requires-Dist: nicegui; extra == "ci"
Requires-Dist: mypy; extra == "ci"
Requires-Dist: ruff; extra == "ci"
Requires-Dist: pre-commit; extra == "ci"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-aiohttp; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-mock; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: types-lxml; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: commitizen; extra == "dev"
Requires-Dist: babel; extra == "dev"
Dynamic: license-file

# novel-downloader

[![PyPI](https://img.shields.io/pypi/v/novel-downloader-spiritlhl.svg)](https://pypi.org/project/novel-downloader-spiritlhl/)
[![Python](https://img.shields.io/pypi/pyversions/novel-downloader-spiritlhl.svg)](https://www.python.org/downloads/)
[![CI](https://github.com/spiritLHLS/novel-downloader/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/spiritLHLS/novel-downloader/actions/workflows/ci.yml)
[![Hits-of-Code](https://hitsofcode.com/github/spiritLHLS/novel-downloader?branch=main&label=Hits-of-Code)](https://hitsofcode.com/github/spiritLHLS/novel-downloader/view?branch=main&label=Hits-of-Code)

[中文](https://github.com/spiritLHLS/novel-downloader/blob/main/README.md) | [English](https://github.com/spiritLHLS/novel-downloader/blob/main/README.en.md)

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

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

**文档**: [项目文档](https://github.com/spiritLHLS/novel-downloader/blob/main/docs/index.md)

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

---

## 功能特性

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

完整功能列表见: [功能总览](https://github.com/spiritLHLS/novel-downloader/blob/main/docs/index.md)

---

## 安装与更新

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

```bash
pip install -U novel-downloader-spiritlhl
```

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

如需启用 Web GUI:

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

如需启用其它可选功能 (Web UI、图片转文字、额外后端等), 请参见: [安装指南](https://github.com/spiritLHLS/novel-downloader/blob/main/docs/guide/installation.md)

---

## 快速开始 (CLI)

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

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

更多示例见: [CLI 使用示例](https://github.com/spiritLHLS/novel-downloader/blob/main/docs/guide/cli-examples.md)

## 编程接口 (Programmatic API)

```python
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 示例](https://github.com/spiritLHLS/novel-downloader/blob/main/docs/reference/api-examples.md)

---

## 贡献与开发

```bash
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` 及相关法律法规
* 使用本项目产生的任何法律责任由使用者自行承担, 作者不承担相关责任
