java爬虫抓取动态网页(WebCollector-Python项目开发者内核:WebCollectorx )

优采云 发布时间: 2021-12-28 17:03

  java爬虫抓取动态网页(WebCollector-Python项目开发者内核:WebCollectorx

)

  爬虫简介:

  WebCollector 是一个 Java 爬虫框架(内核),无需配置,方便二次开发。它提供了精简的API,只需少量代码即可实现功能强大的爬虫。WebCollector-Hadoop 是WebCollector 的Hadoop 版本,支持分布式爬取。

  目前WebCollector-Python项目已在Github上开源,欢迎大家贡献代码:

  爬虫内核:

  WebCollector 致力于维护一个稳定可扩展的爬虫内核,方便开发者进行灵活的二次开发。内核扩展性强,用户可以基于内核开发自己的爬虫。源代码中集成了Jsoup,用于准确的网页分析。2.x 版本集成了 selenium,可以处理 JavaScript 生成的数据。

  马文:

  

  最新的Maven地址请参考文档:

  文件地址:

  内核架构图:

  

  WebCollector 2.x 版本特点:

  自定义遍历策略可以完成更复杂的遍历服务,比如分页,AJAX可以为每个URL设置附加信息(MetaData),利用附加信息完成很多复杂的服务,比如深度检索、锚文本检索、引用页面检索、POST参数传递、增量更新等。利用插件机制,用户可以自定义自己的Http请求、过滤器、执行器等插件。内置一套基于内存的插件(RamCrawler),不依赖文件系统或数据库,适合一次性爬取,比如搜索引擎的实时爬取。内置一套基于Berkeley DB(BreadthCrawler)的插件:适合处理长期、*敏*感*词*的任务,并具有断点爬取功能,不会因宕机或关机造成数据丢失。集成selenium,可以提取JavaScript生成的信息,轻松定制http请求,内置多代理随机切换功能。可以通过定义http请求来实现模拟登录。使用slf4j作为日志门面,可以连接多种日志,使用类似Hadoop的Configuration机制为每个爬虫定制配置信息。

  WebCollector 2.x 官网及镜像:

  WebCollector 2.x 教程:

  WebCollector 配置

  WebCollector 入门

  WebCollector 功能

  WebCollector 持久化

  WebCollector 高级爬虫定制

  WebCollector 处理 Javascript

<p>import cn.edu.hfut.dmic.webcollector.model.CrawlDatums;

import cn.edu.hfut.dmic.webcollector.model.Page;

import cn.edu.hfut.dmic.webcollector.plugin.rocks.BreadthCrawler;

/**

* Crawling news from github news

*

* @author hu

*/

public class DemoAutoNewsCrawler extends BreadthCrawler {

/**

* @param crawlPath crawlPath is the path of the directory which maintains

* information of this crawler

* @param autoParse if autoParse is true,BreadthCrawler will auto extract

* links which match regex rules from pag

*/

public DemoAutoNewsCrawler(String crawlPath, boolean autoParse) {

super(crawlPath, autoParse);

/*start pages*/

this.addSeed("https://blog.github.com/");

for(int pageIndex = 2; pageIndex

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线