【发布时间】:2014-09-17 15:51:51
【问题描述】:
我见过这个link。但我的问题与此完全不同。
我的 seed.txt 看起来像:
http://a.b.c/
http://d.e.f/
我的 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://a.b.c/*
我想抓取一些这样的网址:
http://a.b.c/index.php?id=1
http://a.b.c/about.php
http://a.b.c/help.html
http://a.b.c/test1/test2/
http://a.b.c/index.php?usv=contact
http://a.b.c/index.php?usv=vdetailpro&id=104&sid=74
类似的东西
我已经通过命令测试过:bin/nutch org.apache.nutch.net.URLFilterChecker -allCombined
并认识到正则表达式不匹配。
谢谢!
【问题讨论】:
-
请注意,由于问号,至少
[?*!@=]将匹配第一行。这是你所期待的吗? -
谢谢@Jordan。很简单
标签: regex url web-crawler nutch