Skip to content

Latest commit

 

History

History
35 lines (32 loc) · 1.78 KB

README.md

File metadata and controls

35 lines (32 loc) · 1.78 KB

如何下载小说?

单线程下载

Downloader downloder = new SingleThreadDownloader();
String path = "out/万古神帝.txt";// 保存路径
String chapterListUrl = "http://www.booktxt.net/3_3571/";// 章节地址
downloader.download(chapterListUrl, path);// 整本书下载
String chapterUrl = "http://www.booktxt.net/3_3571/1292242.html";// 指定的章节
downloader.downloadSkipPrevChapters(chapterUrl, path);// 从指定的章节开始下载所有章节

多线程下载

int fixedThreadCount = 5;// 固定每次下载只用5个线程
Downloader downloder = MultiThreadDownloader.newFixedThreadCountDownloader(Executors.newCachedThreadPool(), fixedThreadCount);
int fixedTaskCount = 100;// 固定每个线程最多下载100章
downloader = MultiThreadDownloader.newFixedTaskCountDownloader(Executors.newCachedThreadPool(), fixedTaskCount);

支持哪些小说网站?

如何支持更多的小说网站?

  1. 实现Novel接口

可参考顶点小说实现

  1. 实现Chapter接口

可参考顶点小说实现

  1. 实现ChapterBody接口

可参考顶点小说实现

  1. 注册到工厂NovelFactory
NovelFactory.register("www.booktxt.net", BookTxtNovel.class, BookTxtChapterBody.class);
NovelFactory.register("www.example.com", ExampleNovel.class, ExampleChapterBody.class);