kamike.collect 网络爬虫开源项目

我要开发同款
匿名用户2015年03月30日
27阅读
开发技术Java
所属分类应用工具、网络爬虫
授权协议未知

作品详情

AnotherSimpleCrawler又一个网络爬虫,可以支持代理服务器的翻墙爬取。

1.数据存在mysql当中。

2.使用时,先修改web-inf/config.ini的数据链接相关信息,主要是数据库名和用户名和密码

3.然后访问https://127.0.0.1/fetch/install链接,自动创建数据库表

4.修改src\java\cn\exinhua\fetch中的RestServlet.java文件:

   FetchInst.getInstance().running=true;   Fetch fetch = new Fetch();   fetch.setUrl("https://www.washingtonpost.com/");    fetch.setDepth(3);    RegexRule regexRule = new RegexRule();    regexRule.addNegative(".*#.*");    regexRule.addNegative(".*png.*");    regexRule.addNegative(".*jpg.*");    regexRule.addNegative(".*gif.*");    regexRule.addNegative(".*js.*");    regexRule.addNegative(".*css.*");    regexRule.addPositive(".*php.*");    regexRule.addPositive(".*html.*");    regexRule.addPositive(".*htm.*");    Fetcher fetcher = new Fetcher(fetch);    fetcher.setProxyAuth(true);    fetcher.setRegexRule(regexRule);    List<Fetcher> fetchers = new ArrayList<>();    fetchers.add(fetcher);    FetchUtils.start(fetchers);    将其配置为需要的参数,然后访问https://127.0.0.1/fetch/fetch启动爬取    代理的配置在Fetch.java文件中:    protected int status;protected boolean resumable = false;protected RegexRule regexRule = new RegexRule();protected ArrayList<String> seeds = new ArrayList<String>();protected Fetch fetch;protected String proxyUrl="127.0.0.1";protected int proxyPort=4444;protected String proxyUsername="hkg";protected String proxyPassword="dennis";protected boolean proxyAuth=false;

5.访问https://127.0.0.1/fetch/suspend可以停止爬取

查看全文
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论