nutch网上有不少有它的源码解析,但是采集这块还是不太让人容易理解.今天终于知道怎么,弄的.现在把crawl-urlfilter.txt文件贴出来,让大家一块交流,也给自己备忘录一个。

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# The url filter file used by the crawl command.

# Better for intranet crawling.
# Be sure to change MY.DOMAIN.NAME to your domain name.

# Each non-comment, non-blank line contains a regular expression
# prefixed by '+' or '-'.  The first matching pattern in the file
# determines whether a URL is included or ignored.  If no pattern
# matches, the URL is ignored.

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

# skip image and other suffixes we can't yet parse
-\.(gif|GIF|jpg|JPG|png|PNG|ico|ICO|css|sit|eps|wmf|zip|ppt|mpg|xls|gz|rpm|tgz|mov|MOV|exe|jpeg|JPEG|bmp|BMP)$

# skip URLs containing certain characters as probable queries, etc.

//采集动态网站很重要。必须这样设置。不然像a.jsp?a=001 带有问号的网页就没办法采集。
+[?*!@=]

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

# accept hosts in MY.DOMAIN.NAME
###########################7shop24########################################
#+^http://([a-z0-9]*\.)*7shop24.com/
#+^http://www.7shop24.com/indexdtl06.asp\?classid=([0-9]*)&productid=([0-9]*)+$

###############################http://www.redbaby.com.cn/##############################

//采集是有顺序的,不是随便写的。比如:你要采集产品页,你首先得把首页放进来,然后产品是放在分类页面的,你得把//分类也得包括进来,然后再把具体产品规则的正则写进来,这样才能完成你所需要的任务。如:
+^http://www.redbaby.com.cn/$
+^http://www.redbaby.com.cn/([a-zA-Z]*\.)*index.html$
+^http://www.redbaby.com.cn/([a-zA-Z]*)/$
+^http://www.redbaby.com.cn/([a-zA-Z]*)/index\.html+$
+^http://www.redbaby.com.cn/Product/Product_List.aspx\?Site=\d&BranchID=\d&DepartmentID=\d+$ 
+^http://www.redbaby.com.cn/Product/ProductInfo\w\d\w([0-9]*\.)*html$
+^http://www.redbaby.com.cn/Product/Product_List.aspx\?Site=\d&BranchID=\d&DepartmentID=\d&SortID=\d+$
+^http://www.redbaby.com.cn/Product/ProductInfo\w\d\w\d\.htm$
# skip everything else
-.

#例如采集大麦的票务信息

+^http://www.damai.cn/map.html
+^http://www.damai.cn/allticket\w\d+\.html$
-^http://item.damai.cn/(.*)aspx(.*)$
+^http://item.damai.cn/

url匹配可能用到的java正则:

?    对应     \?

_ (下划线)  对应   \w

.(点号)    对应  \.

Nutch URL过滤配置规则的更多相关文章

  1. Apache URL rewrite 配置

    下面是Apache的配置过程,可以参考下:1.httpd.conf配置文件中加载了mod_rewrite.so模块,使用虚拟主机 #LoadModule rewrite_module modules/ ...

  2. DZ 3.2 URL 伪静态配置 教程

    原文转自:http://www.zccode.com/thread-682-1-1.html 教程说明: 1 首先需要下载URL重写工具,拷到服务器下面安装即可,这里配置IIS7(x64)伪静态. 工 ...

  3. URL过滤

    URL过滤 就是网址过滤.把不安全的.少儿不宜的.政治的东西过滤掉,访问这些网址就会提示受限,不能访问. 一.url过滤简介 针对企业对员工上网行为的控制管理,可以采用URL过滤技术.如企业不允许研发 ...

  4. dubbo之配置规则

    配置规则 向注册中心写入动态配置覆盖规则 1.该功能通常由监控中心或治理中心的页面完成. RegistryFactory registryFactory = ExtensionLoader.getEx ...

  5. 3/19 Django框架 url路由配置及模板渲染

    3/19 Django框架 url路由配置及模板渲染 1.路由分配 URL(Uniform Resoure Locato):统一资源定位符是对可以从互联网上得到的资源的位置和访问方法的一种简洁的表示, ...

  6. Springboot中以配置类方式自定义Mybatis的配置规则(如开启驼峰映射等)

    什么是自定义Mybatis的配置规则? 答:即原来在mybatis配置文件中中我们配置到<settings>标签中的内容,如下第6-10行内容: 1 <?xml version=&q ...

  7. Atitit.实现反向代理(1)----url rewrite 配置and内容改写 and -绝对路径链接改写 java php

    Atitit.实现反向代理(1)----url rewrite  配置and内容改写 and -绝对路径链接改写 java php 1. 代理的实现:::普通代理and反向代理?? 1 2. url  ...

  8. quartz 时间配置规则

    quartz 时间配置规则 格式: [秒] [分] [小时] [日] [月] [周] [年]  序号 说明  是否必填  允许填写的值 允许的通配符  1  秒  是  0-59    , - * / ...

  9. Linux iptables 配置规则

    Linux iptables 防火墙配置规则 前言:把网上我感觉不错iptables的访问规则都统一在这里,以后做参考. modprobe ipt_MASQUERADE modprobe ip_con ...

随机推荐

  1. 基于jquery的可拖动div

    昨天给大家介绍了一款基于jquery ui漂亮的可拖动div实例,今天要给大家分享一款基于jquery的可拖动div.这款可拖动div只要引用jquery就可以,无需引用jquery ui.还实时记录 ...

  2. java安全性的一种简单思路

    关于接口安全性的考虑.这客户端在调用接口时,将acId授权码以加密的方式(可逆加密方式)传递过来, 服务端这边接收后进行解密,然后在服务器端这边的授权名单中进行匹配,判断该授权码是否被授权,从而判断第 ...

  3. 【WPF】Window窗体禁用最大化/最小化按钮

    需求:弹窗的右上角不显示最大化.最小化按钮. 在< Window >节点添加属性以下属性即可: ResizeMode="NoResize" 或者直接在Propertie ...

  4. java资料——链表(转)

    链表 链表是一种物理存储单元上非连续.非顺序的存储结构,数据元素的逻辑顺序是通过链表中的指针链接次序实现的.链表由一系列结点(链表中每一个元素称为结点)组成,结点可以在运行时动态生成.每个结点包括两个 ...

  5. HAProxy+Varnish+LNMP实现高可用负载均衡动静分离集群部署

    HAProxy高可用负载均衡集群部署 基本信息: 系统平台:VMware WorkStation 系统版本: CentOS Linux release 7.2.1511 (Core) 内核版本: 3. ...

  6. DataGridView使用技巧六:冻结列或行

    一.冻结列 DataGridViewColumn.Frozen属性为true时,该列左侧的所有列被固定,横向滚动时固定列不随滚动条滚动而左右移动.这对于重要列固定很有用. 示例:通过程序固定左侧第二列 ...

  7. Stay hungry, stay foolish. 求知若饥,虚心若愚。

    如果留意我博客的朋友,应该都有看到这句话在我的自我介绍栏目存在了好长一段时间了,另外,我的 QQ.旺旺.MSN等都有这个签名.Stay hungry, stay foolish.(求知若饥,虚心若愚) ...

  8. 普通windows版本安装winServer的特色功能 以dedup功能为展示点

    安装 Windows 功能角色 1.选择安装源 在 Windows 8.1 系统上不存在重复数据删除功能,需要从对应的服务器版本,即 Windows Server 2012 R2 上提取相关文件. 2 ...

  9. tensorflow 单机多GPU mnist实例

    http://blog.csdn.net/guotong1988/article/details/74748806 如何使用多GPU http://wiki.jikexueyuan.com/proje ...

  10. 基于bootstrap的select(可多选)

    如图: