BookMaker 是一个命令行工具,用于从指定 URL 下载书籍,生成目录文件,下载章节,合并章节并生成单个文档,以及将 txt 文件转换为 epub 文件。
BookMaker 提供了以下命令:
获取指定URL书籍的目录列表,并生成目录文件。
BookMaker list -u <url> -s <selector> [-h <host>] [-o <output>]
参数说明:
-u, --url <url>
:设置书籍URL。(必需)-s, --selector <selector>
:设置书籍目录选择器。(必需)-h, --host <host>
:设置章节前面拼接的URL,默认为空。-o, --output <output>
:设置保存文件名,默认为chapters.json
。
根据目录信息下载章节。
BookMaker down -j <json> -s <selector> [-d <dir>] [-r <regex>] [-n <next>] [-w <wait>] [-b <begin>]
参数说明:
-j, --json <json>
:设置书籍目录 json 文件,默认为chapters.json
。-s, --selector <selector>
:设置章节内容选择器。(必需)-d, --dir <dir>
:设置书籍保存目录,默认为download
。-r, --regex <regex>
:设置广告内容删除正则,默认为空。-n, --next <next>
:设置下一页判断选择器,默认为空。-w, --wait <wait>
:设置等待秒数,默认为 10。-b, --begin <begin>
:设置开始章节,默认为 1。
合并章节生成单个文档。
BookMaker make -j <json> [-d <dir>] [-f <format>] [-o <output>] [-t <title>] [-a <author>] [-i <intro>] [-c <cover>]
参数说明:
-j, --json <json>
:设置书籍目录 json 文件,默认为chapters.json
。-d, --dir <dir>
:设置书籍章节目录,默认为download
。-f, --format <format>
:设置书籍类型,默认为txt
。可选值为txt
和epub
。-o, --output <output>
:设置书籍保存文件名,默认为book.txt
。-t, --title <title>
:设置书籍标题,默认为book
。-a, --author <author>
:设置书籍作者,默认为空。-i, --intro <intro>
:设置书籍简介,默认为空。-c, --cover <cover>
:设置书籍封面,默认为空。
将 txt 文件转换为 epub 文件。
BookMaker txt2epub -f <file> [-r <regex>] [-d <debug>] [-o <output>] [-t <title>] [-a <author>] [-i <intro>] [-c <cover>]
参数说明:
-f, --file <file>
:设置要转换的 txt 文件。(必需)-r, --regex <regex>
:设置目录提取正则,默认为空,使用内置正则。-d, --debug <debug>
:设置是否为测试模式,默认为false
。-o, --output <output>
:设置书籍保存文件名,默认为book.epub
。-t, --title <title>
:设置书籍标题,默认为book
。-a, --author <author>
:设置书籍作者,默认为空。-i, --intro <intro>
:设置书籍简介,默认为空。-c, --cover <cover>
:设置书籍封面,默认为空。