【问题标题】:Nutch does not crawl multiple sitesNutch 不会抓取多个站点
【发布时间】:2012-06-01 09:38:58
【问题描述】:

我正在尝试使用 Nutch 抓取多个网站。我的 seed.txt 看起来像这样:

http://1.a.b/
http://2.a.b/

我的 regex-urlfilter.txt 看起来像这样:

# skip file: ftp: and mailto: urls
-^(file|ftp|mailto):

# skip image and other suffixes we can't yet parse
# for a more extensive coverage use the urlfilter-suffix plugin
-\.(gif|GIF|jpg|JPG|png|PNG|ico|ICO|css|CSS|sit|SIT|eps|EPS|wmf|WMF|zip|ZIP|ppt|PPT|mpg|MPG|xls|XLS|gz|GZ|rpm|RPM|tgz|TGZ|mov|MOV|exe|EXE|jpeg|JPEG|bmp|BMP|js|JS)$

# skip URLs containing certain characters as probable queries, etc.
-[?*!@=]

# skip URLs with slash-delimited segment that repeats 3+ times, to break loops
-.*(/[^/]+)/[^/]+\1/[^/]+\1/

# accept anything else
#+.
+^http://1.a.b/*
+^http://2.a.b/*

我在最后一部分尝试了以下内容:

+^http://([a-z0-9]*\.)*a.b/*

唯一被抓取的网站是第一个网站。所有其他配置均为默认配置。

我运行以下命令:

bin/nutch crawl urls -solr http://localhost:8984/solr/ -dir crawl -depth 10 -topN 10

有什么想法吗?!

谢谢!

【问题讨论】:

  • 看来我的 -depth 和 -topN 设置得太低了。另外,我在 nutch-site.xml 中添加了一个属性: db.ignore.external.linkstrue 如果为 true,则从页面指向外部主机将被忽略。这是一种将爬网限制为仅包括最初注入的主机的有效方法,而无需创建复杂的 URLFilters。
  • 是的,只要我主要使用 -depth 和 -topN 值,所有页面都被索引。我还对配置文件进行了许多其他更改,这大大提高了速度。
  • @marrop 您能告诉我们您对配置文件进行了哪些其他更改以提高速度吗?如何一次抓取两个不同的域?这可能吗?

标签: nutch web-crawler multiple-sites


【解决方案1】:

在 regex-urlfilter.txt 中试试这个:

旧设置:

# accept anything else
#+.
+^http://1.a.b/*
+^http://2.a.b/*

新服务:

# accept anything else
+.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-16
    • 1970-01-01
    相关资源
    最近更新 更多