Another Simple Crawler 又一个网络爬虫,可以支持代理服务器的FQ爬取。

1.数据存在mysql当中。

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

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
   FetchInst.getInstance().running=true;
 
   Fetch fetch = new Fetch();
 
   fetch.setUrl("http://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);
 
 
    将其配置为需要的参数,然后访问http://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.访问http://127.0.0.1/fetch/suspend可以停止爬取

hubinix / kamike.collect

Watch2 Fork3

Another Simple Crawler — More...

master分支代码最近更新:2015-03-30

下载zip

网络爬虫 kamike.collect的更多相关文章

  1. 【转】44款Java 网络爬虫开源软件

    原帖地址 http://www.oschina.net/project/lang/19?tag=64&sort=time 极简网络爬虫组件 WebFetch WebFetch 是无依赖极简网页 ...

  2. Python初学者之网络爬虫(二)

    声明:本文内容和涉及到的代码仅限于个人学习,任何人不得作为商业用途.转载请附上此文章地址 本篇文章Python初学者之网络爬虫的继续,最新代码已提交到https://github.com/octans ...

  3. 网络爬虫:使用Scrapy框架编写一个抓取书籍信息的爬虫服务

      上周学习了BeautifulSoup的基础知识并用它完成了一个网络爬虫( 使用Beautiful Soup编写一个爬虫 系列随笔汇总 ), BeautifulSoup是一个非常流行的Python网 ...

  4. 网络爬虫: 从allitebooks.com抓取书籍信息并从amazon.com抓取价格(3): 抓取amazon.com价格

    通过上一篇随笔的处理,我们已经拿到了书的书名和ISBN码.(网络爬虫: 从allitebooks.com抓取书籍信息并从amazon.com抓取价格(2): 抓取allitebooks.com书籍信息 ...

  5. 网络爬虫: 从allitebooks.com抓取书籍信息并从amazon.com抓取价格(2): 抓取allitebooks.com书籍信息及ISBN码

    这一篇首先从allitebooks.com里抓取书籍列表的书籍信息和每本书对应的ISBN码. 一.分析需求和网站结构 allitebooks.com这个网站的结构很简单,分页+书籍列表+书籍详情页. ...

  6. 网络爬虫: 从allitebooks.com抓取书籍信息并从amazon.com抓取价格(1): 基础知识Beautiful Soup

    开始学习网络数据挖掘方面的知识,首先从Beautiful Soup入手(Beautiful Soup是一个Python库,功能是从HTML和XML中解析数据),打算以三篇博文纪录学习Beautiful ...

  7. Atitit.数据检索与网络爬虫与数据采集的原理概论

    Atitit.数据检索与网络爬虫与数据采集的原理概论 1. 信息检索1 1.1. <信息检索导论>((美)曼宁...)[简介_书评_在线阅读] - dangdang.html1 1.2. ...

  8. Java 网络爬虫获取页面源代码

    原博文:http://www.cnblogs.com/xudong-bupt/archive/2013/03/20/2971893.html 1.网络爬虫是一个自动提取网页的程序,它为搜索引擎从万维网 ...

  9. [Search Engine] 搜索引擎技术之网络爬虫

    随着互联网的大力发展,互联网称为信息的主要载体,而如何在互联网中搜集信息是互联网领域面临的一大挑战.网络爬虫技术是什么?其实网络爬虫技术就是指的网络数据的抓取,因为在网络中抓取数据是具有关联性的抓取, ...

随机推荐

  1. BZOJ 1008 越狱 (组合数学)

    题解:正难则反,从总数中减去全部相邻不相同的数目就是答案,n*(n-1)^(m-1):第一个房间有n中染色方案,剩下m-1个房间均只有n-1种染色方案,用总数减就是答案. #include <c ...

  2. HDU 1131 Count the Trees

    卡特兰数再乘上n的阶乘 #include<iostream> #include<cstdio> using namespace std; #define base 10000 ...

  3. JAVA GUI学习 - JInternalFrame浮动窗口:可拖拽窗口(依赖于父窗口)

    public class JInternalFrameKnow extends JInternalFrame { public JInternalFrameKnow() { this.setBound ...

  4. java代码发送JSON格式的httpPOST请求

    package com.test; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOE ...

  5. 分析php获取客户端ip

    用php能获取客户端ip,这个大家都知道,代码如下: /** * 获取客户端ip * @param number $type * @return string */ function getClien ...

  6. UILabel显示html文本

    NSString * htmlString = @"<html><body> Some html string \n <font size=\"13\ ...

  7. C++对象的销毁

  8. BZOJ 4260: Codechef REBXOR( trie )

    求出前缀和, 那么以第x个元素结尾的最大异或值是max(sumx^sump)(1≤p<x), 用trie加速. 后缀同理, 然后扫一遍就OK了.时间复杂度O(31N) ------------- ...

  9. oracle修改数据库语言

    alter session set nls_language = 'simplified chinese'; alter session set nls_language = 'american'; ...

  10. Android Bug 记录

    1.Unable to resolve target 'android-5' 无法解析目标 ' 安卓系统-5'      Unable to resolve target 'Google Inc.:G ...