转载请注明出处:http://blog.csdn.net/xiaojimanman/article/details/46812645
http://www.llwjy.com/blogdetail/9df464b20cca5405c7ce07e2fb2d768f.html
个人博客站已经上线了,网址 www.llwjy.com ~欢迎各位吐槽~
-------------------------------------------------------------------------------------------------
在前面的几篇博客中,我们已经介绍了如何采集纵横小说网站上的信息以及如何把这些信息持久化到数据库中,现在我们就开始介绍如何做分布式采集,让各个模块之间可以完美的配合。
采集类修改
在开始介绍分布式采集之前,我们需要对之前介绍的采集类添加一些方法,也就是返回上一篇博客中介绍的小说javabean,具体源码还请参照个人网站上的博客源码。
1.简介页
简介页需呀添加一个方法,让它返回简介页的数据信息,具体如下:
/**
* @return
* @Author:lulei
* @Description: 分析简介页,获取简介页数据
*/
public NovelIntroModel getNovelIntro() {
NovelIntroModel bean = new NovelIntroModel();
bean.setMd5Id(ParseMD5.parseStrToMd5L32(this.pageUrl));
bean.setName(getName());
bean.setAuthor(getAuthor());
bean.setDescription(getDesc());
bean.setType(getType());
bean.setLastChapter(getLatestChapter());
bean.setChapterlisturl(getChapterListUrl());
bean.setWordCount(getWordCount());
bean.setKeyWords(keyWords());
return bean;
}
2.阅读页
阅读页内同样需要添加一个方法,让它返回阅读页内的数据信息,具体如下:
/**
* @return
* @Author:lulei
* @Description: 分析阅读页,获取阅读页数据
*/
public NovelReadModel getNovelRead(){
NovelReadModel novel = new NovelReadModel();
novel.setTitle(getTitle());
novel.setWordCount(getWordCount());
novel.setContent(getContent());
return novel;
}
<