larbin是一种高效的搜索引擎爬虫工具,larbin官方地址:http://larbin.sourceforge.net/index-eng.html,我下的是larbin-2.6.3.tar.gz版本。
一、编译
命令行sudo apt-get install [softname]安装gcc、g++、make、xutils-dev
(1)打开./adns/internal.h文件,把568-571行直接注释掉就行了。
或者:
adns文件夹下internal.h文件569-571:
adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu,
vbuf *vb, parsedomain_flags flags,
const byte *dgram, int dglen, int *cbyte_io, int max);
更正为:
adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu,
vbuf *vb, adns_queryflags flags,
const byte *dgram, int dglen, int *cbyte_io, int max);
(2)将所有文件的iostream.h头文件改为iostream并加上using namespace std;
(3)./src/fetch/file.h中的第105行 inline Vector<char> *html::getLinks () { return &links; }改为inline Vector<char> *getLinks () { return &links; }
二、执行
进入解压缩后的目录执行
./configure
make
通过./larbin执行。
默认情况下larbin不执行任何输出,可通过修改larbin.conf和option.h修改配置参数,部分参数亦可通过修改types.h文件。 修改option.h和types.h文件需要重新编译。
* 默认情况下其配置文件为larbin.conf,可通过参数 -c filename 设置自己的配置文件。
* 可通过 -scratch 参数让larbin重新开始抓取网页。
三、配置
http://larbin.sourceforge.net/custom-eng.html
How to customize Larbin文中有介绍
配置文件larbin.conf文件各项简介:(修改配置文件不需要重新编译larbin)
###############################################
# Who are you ?
# mail of the one who launched larbin (YOUR mail)
From larbin2.6.3@unspecified.mail #//用于http头,web服务器管理员可通过该地址联
#//系执行larbin的人
# name of the bot (sent with http headers)
UserAgent larbin_2.6.3 #//客户端标志 ############################################
# What are the inputs and ouputs of larbin
# port on which is launched the http statistic webserver
# if unset or set to 0, no webserver is launched
httpPort 8081 #//laibin有一个简单的web服务器,可通过http://localhost::8081监控其
#//运行状态,如果该值为0,则不启动web服务器。
# port on which you can submit urls to fetch
# no input is possible if you comment this line or use port 0
inputPort 1976
############################################
# parameters to adapt depending on your network
# Number of connexions in parallel (to adapt depending of your network speed)
pagesConnexions 100 #//并行获取网页的数量,该值可依据网络带宽调整
# Number of dns calls in parallel
dnsConnexions 5 #//并行解析dns的数量
# How deep do you want to go in a site
depthInSite 5 #//网页抓取深度
# do you want to follow external links
noExternalLinks #//是否允许抓取域名外连接
# time between 2 calls on the same server (in sec) : NEVER less than 30
waitDuration 60 #//对同一个服务器获取网页的间隔时间
# Make requests through a proxy (use with care)
#proxy www 8080 #//代理地址
##############################################
# now, let's customize the search
# first page to fetch (you can specify several urls)
startUrl http://www.baidu.com #//抓取网页的起始URL,可指定多值
# Do you want to limit your search to a specific domain ?
# if yes, uncomment the following line
#limitToDomain .fr .dk .uk end
# What are the extensions you surely don't want
# never forbid .html, .htm and so on : larbin needs them
#//限制不被下载的对象的后缀,可通过注释或者增加后缀控制下载
forbiddenExtensions
.tar .gz .tgz .zip .Z .rpm .deb
.ps .dvi .pdf
.png .jpg .jpeg .bmp .smi .tiff .gif
.mov .avi .mpeg .mpg .mp3 .qt .wav .ram .rm
.jar .java .class .diff
.doc .xls .ppt .mdb .rtf .exe .pps .so .psd
end
附上
larbin代码阅读笔记
http://blog.csdn.net/boabc2304/archive/2008/09/19/2950193.aspx