NAME
download novel /bbs thread 小说/贴子下载器
site
support novel/forum website 支持小说/贴子站点
type
support robot ouput file type, 支持小说输出形式
INSTALL
for example, on debian, 以debian环境为例
apt install parallel calibre cpanminus firefox chromium-browser
cpanm Novel::Robot
EXAMPLE
novel-robot -u "https://www.jjwxc.net/onebook.php?novelid=14838" -t html -i 1-3
novel-robot -s txt -f 作者-书名.txt -t html
ARG
Usage: novel-robot [options]
-s : site, 指定站点
-u : book url,小说url
-w : writer name 作者名
-b : book name,书名
-f : txt file / txt file dir, 指定文本文件来源(可以是单个目录或文件)
-t : packer type (html/txt), 小说保存类型,例如txt/html
-o : output packer filename, 保存的小说文件名
-i : min_item_num-max_item_num, 只取 x-y 章/楼
--back_index: back item num, 不取 倒数 back_index 章/楼
-j : min_page_num-max_page_num, 只取 x-y 页
--cookie : firefox cookies.sqlite / netscape HTTP cookie file / cookie string, details in Novel::Robot::Browser
-D : only print info, not download, 只输出信息,不下载
-c : class, 指定类型 novel, tiezi, page
-v : verbose
--progress: 显示进度条(默认不显示)
-h, --help: 显示帮助
--agent : default, firefox (GET), chrome (GET)
--with_toc : 小说保存时是否生成目录(默认是)
--grep_content : 提取关键字
--filter_content : 过滤关键字
--only_poster : 贴子只看楼主
--min_content_word_num : 贴子每楼层最小字数
--max_process_num : 进程个数
--chapter_regex: 指定分割章节的正则表达式(例如:"第[ \\t\\d]+章")
--content_path : xpath to extract content, 提取content的路径
--writer_path : xpath to extract writer, 提取writer的路径
--book_path : xpath to extract book, 提取book的路径
--item_list_path : xpath to extract item_list, 提取item_list的路径
--content_regex : regex to extract content, 提取content的正则
--writer_regex : regex to extract writer, 提取writer的正则
--book_regex : regex to extract book, 提取book的正则
-B : board_url / board_id 版块url,或版块编号
-m, --mail_msg : 消息
-M, --mail_server : 邮件SMTP服务器
-p, --mail_port : 邮件SMTP服务器端口
-U, --mail_usr : 发件人账号
-P, --mail_pwd : 发件人密码
-F, --mail_from : 发件人邮箱
-T, --mail_to : 收件人邮箱
download novel
download novel from url
下载小说
novel-robot -u "https://www.jjwxc.net/onebook.php?novelid=14838" -t html
novel-robot -u "https://www.jjwxc.net/onebook.php?novelid=14838" -t html -i 3-4
novel-robot -u "https://www.jjwxc.net/onebook.php?novelid=14838" -t html -i 3-
novel-robot -u "https://www.jjwxc.net/onebook.php?novelid=14838" -t html -i -3
use cookie
以firefox浏览器为例,先登录对应站点,然后用 cookies.txt 扩展导出cookies.txt,则可以下载当前登录账号所购买的小说; 也可直接指定firefox配置目录下的cookies.sqlite文件; 或者直接使用m.jjwxc.net的cookie字符串
绿晋江 VIP 可通过 --cookie 指定 Netscape cookies.txt、Firefox cookies.sqlite,或直接传入 Cookie 字符串。
parse txt
parse chapter name with regex, convert txt to ebook
可指定章节标题的正则式,把txt文件转成电子书
novel-robot -s txt -w 牵机 -b 断情逐妖记 -f dq1.txt -t html
novel-robot -s txt -w 牵机 -b 断情逐妖记 -f dq1.txt,dq2.txt,dir1 --chapter_regex "第[ \\t\\d]+章" -t html
novel-robot -s txt -f 飘灯-像妖怪一样自由.txt -t html
only print info
only print info, but not download, 输出小说信息(不下载)
novel-robot -u "https://www.jjwxc.net/onebook.php?novelid=14838" -D
convert ebook
use calibre to convert a novel file into epub/mobi/..., default filename format is [writer]-[bookname].[type]
使用calibre将下载的 html 格式小说转换成其他格式的电子书,例如 epub、mobi 等。如果未指定 writer 及 book 选项,则需要将 html 源文件名称设置为 [作者-书名]
novel-robot -f 天平-风起阿房.html -t epub
novel-robot -f mxj.html -w 施定柔 -b 迷侠记 -t epub
send email
download/convert novel, use calibre-smtp to send ebook to email address : xxx@kindle.com
下载小说并使用calibre-smtp推送到指定邮箱
本地 SMTP 服务使用 -T 和 -F;远程 SMTP 服务另外使用 -M、-p、-U 和 -P。邮箱、账号及密码必须替换为真实配置,因此不提供不可直接运行的占位示例。
bulk download
下载专栏内的所有小说:
novel-robot -B "https://www.jjwxc.net/oneauthor.php?authorid=14644"
FUNCTION
get_novel
my $xs = Novel::Robot->new(
site => 'jjwxc',
type => 'html',
);
my $index_url = 'https://www.jjwxc.net/onebook.php?novelid=14838';
$xs->get_novel($index_url);
get_novel_ref
get novel / forum thread data hash ref
获取小说/贴子内容,返回一个hash引用
my $r = $xs->get_novel_ref($url, %opt);
get_novel_info
get novel index info / forum thread first page info
获取小说/贴子首页信息
my $r = $xs->get_novel_info($url);