manhuagui-cli 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,28 +1,72 @@
1
1
  # manhuagui-cli
2
2
 
3
- > 漫画柜 (manhuagui.com) 漫画下载命令行工具
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/manhuagui-cli"><img src="https://img.shields.io/npm/v/manhuagui-cli" alt="npm version"></a>
5
+ <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D22-brightgreen" alt="Node.js >= 22"></a>
6
+ <a href="./LICENSE"><img src="https://img.shields.io/npm/l/manhuagui-cli" alt="License: MIT"></a>
7
+ </p>
8
+
9
+ <p align="center">漫画柜 (manhuagui.com) 漫画下载命令行工具</p>
10
+
11
+ ---
12
+
13
+ ## 目录
14
+
15
+ - [快速开始](#快速开始)
16
+ - [功能特性](#功能特性)
17
+ - [安装](#安装)
18
+ - [使用方法](#使用方法)
19
+ - [交互模式](#交互模式)
20
+ - [命令行模式](#命令行模式)
21
+ - [选项](#选项)
22
+ - [配置](#配置)
23
+ - [优先级](#优先级)
24
+ - [配置文件](#配置文件)
25
+ - [环境变量](#环境变量)
26
+ - [输出目录结构](#输出目录结构)
27
+ - [开发](#开发)
28
+ - [变更日志](#变更日志)
29
+ - [许可协议](#许可协议)
30
+ - [免责声明](#免责声明)
31
+
32
+ ## 快速开始
4
33
 
5
- [English](README_EN.md)
34
+ ```bash
35
+ # 全局安装
36
+ npm install -g manhuagui-cli
6
37
 
7
- ## 功能特性
38
+ # 下载漫画,按提示操作
39
+ manhuagui-cli
40
+
41
+ # 或者在命令行直接指定 URL
42
+ manhuagui-cli <URL>
43
+
44
+ # 指定章节组
45
+ manhuagui-cli <URL> -s "单行本"
46
+
47
+ # 预览模式,仅列出章节不下载
48
+ manhuagui-cli <URL> --dry-run
8
49
 
9
- - 交互式命令行界面,也支持命令行参数直接运行
10
- - 自动解析漫画页面,列出所有章节与卷
11
- - 使用 Playwright 模拟浏览器请求,绕过反爬检测
12
- - 随机 User-Agent 和视口大小,模拟真实用户行为
13
- - CDN 节点自动轮换,图片下载失败时自动重试(最多 3 次)
14
- - 章节内图片并发下载,章节之间顺序处理并添加随机延迟
15
- - 断点续传:进度保存到 `progress.json`,中断后可通过 `--resume` / `-r` 继续
16
- - 下载目录结构清晰:`output/<漫画名>/<章节组>/<章节>/001.webp`
50
+ # 断点续传
51
+ manhuagui-cli <URL> --resume
52
+ ```
17
53
 
18
- ## 系统要求
54
+ ## 功能特性
19
55
 
20
- - **Node.js** >= 22
21
- - **pnpm**(推荐)或 npm
56
+ - **交互式界面**:无参数运行时进入交互提示模式,引导输入 URL、选择章节组
57
+ - **命令行模式**:支持完整 CLI 参数,适合脚本化和自动化场景
58
+ - **反爬虫绕过**:基于 Playwright 无头 Chromium 模拟浏览器请求,绕过反爬检测
59
+ - **身份伪装**:随机切换 User-Agent 和视口大小,模拟真实用户行为
60
+ - **CDN 容错**:图片下载时自动轮换 CDN 节点,失败自动重试(默认 3 次)
61
+ - **并发控制**:章节内图片并发下载,章节间顺序处理并加入随机延迟
62
+ - **实时进度显示**:终端进度条,展示下载速度、章节进度、整体进度及预计剩余时间
63
+ - **预览模式** (`--dry-run`):列出待下载章节而不实际下载,适合制定下载计划
64
+ - **断点续传**:进度自动保存至 `progress.json`,中断后通过 `--resume` / `-r` 继续
65
+ - **清晰目录结构**:`output/<漫画名>/<章节组>/<章节>/001.webp`
22
66
 
23
67
  ## 安装
24
68
 
25
- ### npm(推荐)
69
+ ### npm 全局安装(推荐)
26
70
 
27
71
  ```bash
28
72
  npm install -g manhuagui-cli
@@ -44,53 +88,81 @@ pnpm link --global
44
88
 
45
89
  ### 交互模式
46
90
 
91
+ 不带参数运行,工具会引导你完成每一步操作:
92
+
47
93
  ```bash
48
- pnpm dev
49
- # 或编译后:
50
- pnpm build
51
- node dist/index.js
94
+ manhuagui-cli
52
95
  ```
53
96
 
54
- 按提示输入漫画 URL,选择要下载的章节组,确认后开始下载。
97
+ 交互流程:
98
+
99
+ 1. 输入漫画 URL
100
+ 2. 工具自动解析漫画信息(标题、章节组、章节列表)
101
+ 3. 选择要下载的章节组(支持多选)
102
+ 4. 确认后开始下载
103
+
104
+ ```text
105
+ manhuagui-cli v1.0.1
106
+
107
+ Input comic URL:
108
+ https://www.manhuagui.com/comic/12345/
109
+
110
+ Parsing comic page...
111
+ 某个漫画
112
+
113
+ Which sections to download?
114
+ [x] 单行本 (12 chapters)
115
+ [ ] 单话 (200 chapters)
116
+ [x] 番外 (3 chapters)
117
+ Confirm
118
+
119
+ Overall 3/4 ch · 6/8 pg · 45s elapsed · ~15s
120
+ [====================> ] 50%
121
+ Ch.3 2/2 pg · 单行本 · 93.5 KB/s · ~15s
122
+ ```
55
123
 
56
124
  ### 命令行模式
57
125
 
58
126
  ```bash
59
- node dist/index.js <URL> [选项]
60
- # 或全局安装后:
61
- manhuagui-cli <URL> [选项]
62
-
63
127
  # 查看帮助
64
- node dist/index.js --help
128
+ manhuagui-cli --help
65
129
 
66
- # 示例:下载指定章节组
67
- node dist/index.js https://www.manhuagui.com/comic/12345/ -s "单行本"
130
+ # 下载指定章节组
131
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ -s "单行本"
68
132
 
69
- # 示例:下载指定章节
70
- node dist/index.js https://www.manhuagui.com/comic/12345/ -s "单话" -c "第01话"
133
+ # 下载指定章节
134
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ -s "单话" -c "第01话"
71
135
 
72
- # 示例:断点续传
73
- node dist/index.js https://www.manhuagui.com/comic/12345/ --resume
136
+ # 指定输出目录
137
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ -o ./my-comics
138
+
139
+ # 断点续传
140
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ --resume
141
+
142
+ # 预览模式
143
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ --dry-run
74
144
  ```
75
145
 
76
146
  ### 选项
77
147
 
78
- | 选项 | 简写 | 说明 |
79
- | --------------------- | ----- | --------------------------------------------- |
80
- | `--section <name>` | `-s` | 指定要下载的章节组名称(默认:全部) |
81
- | `--chapter <name>` | `-c` | 指定要下载的章节名称 |
82
- | `--output <dir>` | `-o` | 下载输出目录 |
83
- | `--concurrency <n>` | `-C` | 章节内图片并发下载数 |
84
- | `--retry <n>` | | 图片下载重试次数 |
85
- | `--log-level <level>` | | 日志级别:`debug` \| `info` \| `warn` \| `error` |
86
- | `--resume` | `-r` | 断点续传模式 |
87
- | `--dry-run` | `-d` | 预览模式(不实际下载) |
88
- | `--help` | `-h` | 显示帮助信息 |
89
- | `--version` | `-v` | 显示版本号 |
148
+ | 选项 | 简写 | 默认值 | 说明 |
149
+ | ---------------------- | ----- | ------- | --------------------------------------------- |
150
+ | `--section <name>` | `-s` | 全部 | 指定要下载的章节组名称 |
151
+ | `--chapter <name>` | `-c` | — | 指定要下载的章节名称 |
152
+ | `--output <dir>` | `-o` | `./output` | 下载输出目录 |
153
+ | `--concurrency <n>` | `-C` | `2` | 章节内图片并发下载数 |
154
+ | `--retry <n>` | | `3` | 图片下载重试次数 |
155
+ | `--log-level <level>` | | `info` | 日志级别:`debug` / `info` / `warn` / `error` |
156
+ | `--resume` | `-r` | — | 断点续传模式 |
157
+ | `--dry-run` | `-d` | — | 预览模式(不实际下载) |
158
+ | `--help` | `-h` | — | 显示帮助信息 |
159
+ | `--version` | `-v` | — | 显示版本号 |
90
160
 
91
161
  ## 配置
92
162
 
93
- 所有配置项按以下优先级生效(高优先级覆盖低优先级):
163
+ 除 CLI 参数外,还支持通过配置文件和环境变量调整行为。
164
+
165
+ ### 优先级
94
166
 
95
167
  ```
96
168
  CLI 参数 > 配置文件 > 环境变量 > 默认值
@@ -98,10 +170,13 @@ CLI 参数 > 配置文件 > 环境变量 > 默认值
98
170
 
99
171
  ### 配置文件
100
172
 
101
- 支持两个位置的 JSON 配置文件,项目级覆盖全局级:
173
+ 支持两个位置的 JSON 配置文件,按需创建。项目级会覆盖全局级中相同的字段。
102
174
 
103
- - **项目级**: `<当前目录>/.manhuaguirc.json`
104
- - **全局**: `~/.config/manhuagui-cli/config.json`(Windows: `%USERPROFILE%\.config\manhuagui-cli\config.json`)
175
+ | 位置 | 路径 |
176
+ | ---------- | ---------------------------------------------------------------------------- |
177
+ | 项目级 | `<当前目录>/.manhuaguirc.json` |
178
+ | 全局 | `~/.config/manhuagui-cli/config.json` |
179
+ | (Windows) | `%USERPROFILE%\.config\manhuagui-cli\config.json` |
105
180
 
106
181
  ```json
107
182
  {
@@ -112,28 +187,28 @@ CLI 参数 > 配置文件 > 环境变量 > 默认值
112
187
  }
113
188
  ```
114
189
 
115
- 全部可选,未指定的项使用默认值。
190
+ 所有字段均为可选,未指定的字段将沿用默认值。
116
191
 
117
192
  ### 环境变量
118
193
 
119
- 复制 `.env.example` `.env`,根据需要修改。也支持直接设置系统环境变量。
120
-
121
- | 变量 | 默认值 | 说明 |
122
- | --------------------- | ---------- | ---------------------------------------- |
123
- | `OUTPUT_BASE` | `./output` | 下载输出目录 |
124
- | `IMAGE_CONCURRENCY` | `2` | 章节内图片并发下载数 |
125
- | `DOWNLOAD_DELAY` | `3000` | 图片批次之间延迟(毫秒,0 禁用) |
126
- | `CHAPTER_DELAY_MIN` | `5000` | 章节间最小延迟(毫秒) |
127
- | `CHAPTER_DELAY_MAX` | `15000` | 章节间最大延迟(毫秒) |
128
- | `RETRY_COUNT` | `3` | 图片下载重试次数 |
129
- | `RETRY_BACKOFF_BASE` | `1000` | 重试退避基准毫秒(第 N 次重试等待 N×base) |
130
- | `IMAGE_LOAD_DELAY` | `200` | 翻页后等待图片加载时间(毫秒) |
131
- | `LOG_LEVEL` | `info` | 日志级别:`debug` \| `info` \| `warn` \| `error` |
132
- | `USER_AGENTS` | — | 自定义 User-Agent 列表(每行一个) |
194
+ `.env.example` 复制为 `.env`,根据需要修改。也支持直接设置系统环境变量。
195
+
196
+ | 变量 | 默认值 | 说明 |
197
+ | --------------------- | ---------- | -------------------------------------------- |
198
+ | `OUTPUT_BASE` | `./output` | 下载输出目录 |
199
+ | `IMAGE_CONCURRENCY` | `2` | 章节内图片并发下载数 |
200
+ | `DOWNLOAD_DELAY` | `3000` | 图片批次间延迟(毫秒,设为 0 禁用) |
201
+ | `CHAPTER_DELAY_MIN` | `3000` | 章节间最小延迟(毫秒) |
202
+ | `CHAPTER_DELAY_MAX` | `6000` | 章节间最大延迟(毫秒) |
203
+ | `RETRY_COUNT` | `3` | 图片下载重试次数 |
204
+ | `RETRY_BACKOFF_BASE` | `1000` | 重试退避基值(毫秒),第 N 次重试等待 N * base |
205
+ | `IMAGE_LOAD_DELAY` | `200` | 翻页后等待图片加载时间(毫秒) |
206
+ | `LOG_LEVEL` | `info` | 日志级别:`debug` / `info` / `warn` / `error` |
207
+ | `USER_AGENTS` | — | 自定义 User-Agent 列表(每行一个) |
133
208
 
134
209
  ## 输出目录结构
135
210
 
136
- ```
211
+ ```text
137
212
  output/
138
213
  └── <漫画名>/
139
214
  ├── urls.json # 章节图片 URL 清单
@@ -148,18 +223,22 @@ output/
148
223
  ## 开发
149
224
 
150
225
  ```bash
151
- pnpm install # 安装依赖
152
- pnpm dev # 开发模式运行(直接运行 TypeScript)
153
- pnpm build # 编译 TypeScript
154
- pnpm typecheck # 类型检查
155
- pnpm test # 运行测试
156
- pnpm check # 代码检查和格式化检查
157
- pnpm format # 自动格式化
226
+ pnpm install # 安装依赖
227
+ pnpm dev # 开发模式运行(直接运行 TypeScript)
228
+ pnpm build # 编译 TypeScript
229
+ pnpm typecheck # 类型检查
230
+ pnpm test # 运行测试
231
+ pnpm check # 代码检查和格式化检查(Biome)
232
+ pnpm format # 自动格式化
158
233
  ```
159
234
 
160
- ## License
235
+ ## 变更日志
236
+
237
+ 详见 [CHANGELOG.md](./CHANGELOG.md)。
238
+
239
+ ## 许可协议
161
240
 
162
- [MIT](LICENSE)
241
+ [MIT](./LICENSE)
163
242
 
164
243
  ## 免责声明
165
244
 
package/README_EN.md CHANGED
@@ -1,28 +1,74 @@
1
1
  # manhuagui-cli
2
2
 
3
- > CLI tool for downloading manhua from manhuagui.com
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/manhuagui-cli"><img src="https://img.shields.io/npm/v/manhuagui-cli" alt="npm version"></a>
5
+ <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D22-brightgreen" alt="Node.js >= 22"></a>
6
+ <a href="./LICENSE"><img src="https://img.shields.io/npm/l/manhuagui-cli" alt="License: MIT"></a>
7
+ </p>
8
+
9
+ <p align="center">CLI tool for downloading manhua from manhuagui.com</p>
4
10
 
5
11
  [中文](README.md)
6
12
 
7
- ## Features
13
+ ---
14
+
15
+ ## Table of Contents
16
+
17
+ - [Quick Start](#quick-start)
18
+ - [Features](#features)
19
+ - [Installation](#installation)
20
+ - [Usage](#usage)
21
+ - [Interactive Mode](#interactive-mode)
22
+ - [CLI Mode](#cli-mode)
23
+ - [Options](#options)
24
+ - [Configuration](#configuration)
25
+ - [Priority](#priority)
26
+ - [Config Files](#config-files)
27
+ - [Environment Variables](#environment-variables)
28
+ - [Output Structure](#output-structure)
29
+ - [Development](#development)
30
+ - [Changelog](#changelog)
31
+ - [License](#license)
32
+ - [Disclaimer](#disclaimer)
33
+
34
+ ## Quick Start
35
+
36
+ ```bash
37
+ # Install globally
38
+ npm install -g manhuagui-cli
39
+
40
+ # Download a comic, follow the prompts
41
+ manhuagui-cli
42
+
43
+ # Or specify a URL directly
44
+ manhuagui-cli <URL>
8
45
 
9
- - Interactive CLI with prompts, also supports direct CLI args
10
- - Auto-parses comic pages, lists all sections and chapters
11
- - Uses Playwright headless browser to bypass anti-bot measures
12
- - Random User-Agent and viewport rotation to simulate real users
13
- - CDN host rotation with automatic retry (up to 3 attempts) on image download failure
14
- - Concurrent image downloads within a chapter, sequential chapters with human-like delays
15
- - Resumable downloads: progress saved to `progress.json`, resume with `--resume` / `-r`
16
- - Clean output structure: `output/<comic-title>/<section>/<chapter>/001.webp`
46
+ # Filter by section name
47
+ manhuagui-cli <URL> -s "Single Volumes"
17
48
 
18
- ## Requirements
49
+ # Preview mode, list chapters without downloading
50
+ manhuagui-cli <URL> --dry-run
19
51
 
20
- - **Node.js** >= 22
21
- - **pnpm** (recommended) or npm
52
+ # Resume interrupted download
53
+ manhuagui-cli <URL> --resume
54
+ ```
55
+
56
+ ## Features
57
+
58
+ - **Interactive mode**: Running without arguments launches an interactive prompt that guides you through URL input and section selection
59
+ - **CLI mode**: Full CLI argument support for scripting and automation
60
+ - **Anti-bot evasion**: Uses Playwright headless Chromium to mimic real browser requests and bypass anti-bot measures
61
+ - **Identity rotation**: Randomly switches User-Agent and viewport size to simulate real user behavior
62
+ - **CDN resilience**: Automatically rotates CDN hosts on image download failure with retry (default 3 attempts)
63
+ - **Concurrency control**: Concurrent image downloads within a chapter, sequential chapters with randomized delays
64
+ - **Real-time progress**: Terminal progress bars displaying speed, per-chapter progress, overall progress, and ETA
65
+ - **Preview mode** (`--dry-run`): Lists pending chapters without downloading, useful for planning
66
+ - **Resumable downloads**: Progress automatically saved to `progress.json`, resume with `--resume` / `-r`
67
+ - **Clean directory structure**: `output/<comic-title>/<section>/<chapter>/001.webp`
22
68
 
23
69
  ## Installation
24
70
 
25
- ### npm (Recommended)
71
+ ### npm Global Install (Recommended)
26
72
 
27
73
  ```bash
28
74
  npm install -g manhuagui-cli
@@ -44,53 +90,81 @@ pnpm link --global
44
90
 
45
91
  ### Interactive Mode
46
92
 
93
+ Run without arguments and the tool will guide you through each step:
94
+
47
95
  ```bash
48
- pnpm dev
49
- # or build first:
50
- pnpm build
51
- node dist/index.js
96
+ manhuagui-cli
52
97
  ```
53
98
 
54
- Follow prompts to enter comic URL, select sections, and confirm download.
99
+ Interactive flow:
100
+
101
+ 1. Enter the comic URL
102
+ 2. The tool parses comic metadata (title, sections, chapter list)
103
+ 3. Select which sections to download (multi-select supported)
104
+ 4. Confirm and start downloading
105
+
106
+ ```text
107
+ manhuagui-cli v1.0.1
108
+
109
+ Input comic URL:
110
+ https://www.manhuagui.com/comic/12345/
111
+
112
+ Parsing comic page...
113
+ Some Comic Title
114
+
115
+ Which sections to download?
116
+ [x] Single Volumes (12 chapters)
117
+ [ ] Serialized (200 chapters)
118
+ [x] Extras (3 chapters)
119
+ Confirm
120
+
121
+ Overall 3/4 ch · 6/8 pg · 45s elapsed · ~15s
122
+ [====================> ] 50%
123
+ Ch.3 2/2 pg · Single Volumes · 93.5 KB/s · ~15s
124
+ ```
55
125
 
56
126
  ### CLI Mode
57
127
 
58
128
  ```bash
59
- node dist/index.js <URL> [options]
60
- # or if linked globally:
61
- manhuagui-cli <URL> [options]
62
-
63
129
  # Show help
64
- node dist/index.js --help
130
+ manhuagui-cli --help
65
131
 
66
- # Example: download specific section
67
- node dist/index.js https://www.manhuagui.com/comic/12345/ -s "单行本"
132
+ # Download a specific section
133
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ -s "Single Volumes"
68
134
 
69
- # Example: download specific chapter
70
- node dist/index.js https://www.manhuagui.com/comic/12345/ -s "单话" -c "01"
135
+ # Download a specific chapter
136
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ -s "Serialized" -c "Chapter 01"
71
137
 
72
- # Example: resume interrupted download
73
- node dist/index.js https://www.manhuagui.com/comic/12345/ --resume
138
+ # Specify output directory
139
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ -o ./my-comics
140
+
141
+ # Resume interrupted download
142
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ --resume
143
+
144
+ # Preview mode
145
+ manhuagui-cli https://www.manhuagui.com/comic/12345/ --dry-run
74
146
  ```
75
147
 
76
148
  ### Options
77
149
 
78
- | Option | Alias | Description |
79
- | -------------------- | ----- | -------------------------------------------------------------- |
80
- | `--section <name>` | `-s` | Download only the named section (default: all) |
81
- | `--chapter <name>` | `-c` | Download only the named chapter |
82
- | `--output <dir>` | `-o` | Download output directory |
83
- | `--concurrency <n>` | `-C` | Concurrent image downloads per chapter |
84
- | `--retry <n>` | | Retry count per image download |
85
- | `--log-level <level>`| | Log level: `debug` \| `info` \| `warn` \| `error` |
86
- | `--resume` | `-r` | Resume from previous interrupted download |
87
- | `--dry-run` | `-d` | Preview mode (list chapters without downloading) |
88
- | `--help` | `-h` | Show help |
89
- | `--version` | `-v` | Show version |
150
+ | Option | Alias | Default | Description |
151
+ | --------------------- | ----- | -------- | -------------------------------------------------------------- |
152
+ | `--section <name>` | `-s` | All | Download only the named section |
153
+ | `--chapter <name>` | `-c` | — | Download only the named chapter |
154
+ | `--output <dir>` | `-o` | `./output` | Download output directory |
155
+ | `--concurrency <n>` | `-C` | `2` | Concurrent image downloads per chapter |
156
+ | `--retry <n>` | | `3` | Retry count per image download |
157
+ | `--log-level <level>` | | `info` | Log level: `debug` / `info` / `warn` / `error` |
158
+ | `--resume` | `-r` | — | Resume from previous interrupted download |
159
+ | `--dry-run` | `-d` | — | Preview mode (list chapters without downloading) |
160
+ | `--help` | `-h` | — | Show help |
161
+ | `--version` | `-v` | — | Show version |
90
162
 
91
163
  ## Configuration
92
164
 
93
- All settings follow this priority order (higher overrides lower):
165
+ In addition to CLI arguments, behavior can be customized via config files and environment variables.
166
+
167
+ ### Priority
94
168
 
95
169
  ```
96
170
  CLI args > config files > environment variables > defaults
@@ -98,10 +172,13 @@ CLI args > config files > environment variables > defaults
98
172
 
99
173
  ### Config Files
100
174
 
101
- Two JSON config file locations are supported, project-level overrides global:
175
+ Two JSON config file locations are supported. Project-level overrides global-level fields.
102
176
 
103
- - **Project-level**: `<cwd>/.manhuaguirc.json`
104
- - **Global**: `~/.config/manhuagui-cli/config.json` (Windows: `%USERPROFILE%\.config\manhuagui-cli\config.json`)
177
+ | Location | Path |
178
+ | ------------ | ---------------------------------------------------------------------------- |
179
+ | Project | `<cwd>/.manhuaguirc.json` |
180
+ | Global | `~/.config/manhuagui-cli/config.json` |
181
+ | (Windows) | `%USERPROFILE%\.config\manhuagui-cli\config.json` |
105
182
 
106
183
  ```json
107
184
  {
@@ -118,22 +195,22 @@ All fields are optional; defaults are used for any omitted field.
118
195
 
119
196
  Copy `.env.example` to `.env` and modify as needed. System environment variables are also supported.
120
197
 
121
- | Variable | Default | Description |
122
- | --------------------- | ---------- | --------------------------------------------------- |
123
- | `OUTPUT_BASE` | `./output` | Download output directory |
124
- | `IMAGE_CONCURRENCY` | `2` | Concurrent image downloads per chapter |
125
- | `DOWNLOAD_DELAY` | `3000` | Delay between image batches (ms, 0 to disable) |
126
- | `CHAPTER_DELAY_MIN` | `5000` | Min delay between chapters (ms) |
127
- | `CHAPTER_DELAY_MAX` | `15000` | Max delay between chapters (ms) |
128
- | `RETRY_COUNT` | `3` | Retry count per image download |
129
- | `RETRY_BACKOFF_BASE` | `1000` | Retry backoff base (ms), wait `N × base` on Nth retry |
130
- | `IMAGE_LOAD_DELAY` | `200` | Wait after page turn for image to load (ms) |
131
- | `LOG_LEVEL` | `info` | Log level: `debug` \| `info` \| `warn` \| `error` |
132
- | `USER_AGENTS` | — | Custom User-Agent pool, one per line |
198
+ | Variable | Default | Description |
199
+ | --------------------- | ---------- | ------------------------------------------------------- |
200
+ | `OUTPUT_BASE` | `./output` | Download output directory |
201
+ | `IMAGE_CONCURRENCY` | `2` | Concurrent image downloads per chapter |
202
+ | `DOWNLOAD_DELAY` | `3000` | Delay between image batches (ms, 0 to disable) |
203
+ | `CHAPTER_DELAY_MIN` | `3000` | Min delay between chapters (ms) |
204
+ | `CHAPTER_DELAY_MAX` | `6000` | Max delay between chapters (ms) |
205
+ | `RETRY_COUNT` | `3` | Retry count per image download |
206
+ | `RETRY_BACKOFF_BASE` | `1000` | Retry backoff base (ms), wait `N * base` on Nth retry |
207
+ | `IMAGE_LOAD_DELAY` | `200` | Wait after page turn for image to load (ms) |
208
+ | `LOG_LEVEL` | `info` | Log level: `debug` / `info` / `warn` / `error` |
209
+ | `USER_AGENTS` | — | Custom User-Agent pool, one per line |
133
210
 
134
211
  ## Output Structure
135
212
 
136
- ```
213
+ ```text
137
214
  output/
138
215
  └── <comic-title>/
139
216
  ├── urls.json # Chapter image URL manifest
@@ -148,18 +225,22 @@ output/
148
225
  ## Development
149
226
 
150
227
  ```bash
151
- pnpm install # Install dependencies
152
- pnpm dev # Run in dev mode (TypeScript directly)
153
- pnpm build # Compile TypeScript
154
- pnpm typecheck # Type check
155
- pnpm test # Run tests
156
- pnpm check # Lint and format check
157
- pnpm format # Auto-fix formatting
228
+ pnpm install # Install dependencies
229
+ pnpm dev # Run in dev mode (TypeScript directly)
230
+ pnpm build # Compile TypeScript
231
+ pnpm typecheck # Type check
232
+ pnpm test # Run tests
233
+ pnpm check # Lint and format check (Biome)
234
+ pnpm format # Auto-fix formatting
158
235
  ```
159
236
 
237
+ ## Changelog
238
+
239
+ See [CHANGELOG.md](./CHANGELOG.md).
240
+
160
241
  ## License
161
242
 
162
- [MIT](LICENSE)
243
+ [MIT](./LICENSE)
163
244
 
164
245
  ## Disclaimer
165
246
 
@@ -1,10 +1,22 @@
1
1
  import type { Browser, Page as PlaywrightPage, Response } from "playwright";
2
+ import type { SpeedTracker } from "./speed.js";
2
3
  export declare function computePadLength(count: number): number;
3
4
  export declare function extractExtension(url: string): string;
4
- export declare function buildFilePath(outputDir: string, index: number, padLen: number, ext: string): string;
5
+ export declare function buildFilePath(opts: {
6
+ outputDir: string;
7
+ index: number;
8
+ padLen: number;
9
+ ext: string;
10
+ }): string;
5
11
  export declare function getPageCount(page: PlaywrightPage): Promise<number>;
6
12
  export declare function getSubPageUrls(page: PlaywrightPage): Promise<string[]>;
7
13
  export declare function collectImageUrls(page: PlaywrightPage, pageCount: number): Promise<string[]>;
8
14
  export declare function validateImageResponse(response: Response | null): void;
9
- export declare function extractChapterImages(chapterUrl: string, browser: Browser, outputDir: string): Promise<string[]>;
15
+ export declare function extractChapterImages(opts: {
16
+ chapterUrl: string;
17
+ browser: Browser;
18
+ outputDir: string;
19
+ tracker: SpeedTracker;
20
+ onProgress?: (downloaded: number, total: number, bytes: number) => void;
21
+ }): Promise<string[]>;
10
22
  //# sourceMappingURL=chapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chapter.d.ts","sourceRoot":"","sources":["../../src/lib/chapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAkB,IAAI,IAAI,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO5F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,MAAM,CAGR;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAaxE;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAa5E;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA8BjG;AAYD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAQrE;AAyGD,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,EAAE,CAAC,CA4BnB"}
1
+ {"version":3,"file":"chapter.d.ts","sourceRoot":"","sources":["../../src/lib/chapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAkB,IAAI,IAAI,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,MAAM,CAGT;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAaxE;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAa5E;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA8BjG;AAYD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAQrE;AAsID,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAwCpB"}