<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    小魚的空氣

    記錄我所思

    2007年4月27日

    Nutch 0.9筆記

          一直留意Lucene,Nutch的進(jìn)展,最近這兩個項(xiàng)目都發(fā)展得非常快,Lucne已發(fā)展到 2.1,Nutch已發(fā)展到 0.9,改進(jìn)了很多,令人欣喜。
          今天小試了一下Nutch-0.9,筆記如下:
          
    1、解壓Nutch包,在Nutch根目錄下建目錄urls,里面建一些包含URL的文本如urlt.txt,一行一個URL,內(nèi)容如:http://m.tkk7.com
    http://www.javaeye.com/


    2、修改conf目錄下的crawl-urlfilter.txt,片斷如下:
    # accept hosts in MY.DOMAIN.NAME
    # +^http://([a-z0-9]*\.)*MY.DOMAIN.NAME/
    +^http://m.tkk7.com/
    +^http://www.javaeye.com/
    +^http://lucene.apache.org/

    3、修改conf目錄下的nutch-site.xml,內(nèi)容如下:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

    <!-- Put site-specific property overrides in this file. -->

    <configuration>

        
    <property>
          
    <name>http.agent.name</name>
          
    <value>Nutch</value>
          
    <description>HTTP 'User-Agent' request header. MUST NOT be empty - 
          please set this to a single word uniquely related to your organization.

          NOTE: You should also check other related properties:

            http.robots.agents
            http.agent.description
            http.agent.url
            http.agent.email
            http.agent.version

          and set their values appropriately.

          
    </description>
        
    </property>

        
    <property>
          
    <name>http.robots.agents</name>
          
    <value>Nutch,*</value>
          
    <description>The agent strings we'll look for in robots.txt files,
          comma-separated, in decreasing order of precedence. You should
          put the value of http.agent.name as the first agent name, and keep the
          default * at the end of the list. E.g.: BlurflDev,Blurfl,*
          
    </description>
        
    </property>

        
    <property>
          
    <name>http.agent.description</name>
          
    <value>Nutch Search Engineer</value>
          
    <description>Further description of our bot- this text is used in
          the User-Agent header.  It appears in parenthesis after the agent name.
          
    </description>
        
    </property>

        
    <property>
          
    <name>http.agent.url</name>
          
    <value>http://lucene.apache.org/nutch/bot.html</value>
          
    <description>A URL to advertise in the User-Agent header.  This will 
           appear in parenthesis after the agent name. Custom dictates that this
           should be a URL of a page explaining the purpose and behavior of this
           crawler.
          
    </description>
        
    </property>

        
    <property>
          
    <name>http.agent.email</name>
          
    <value>nutch-agent@lucene.apache.org</value>
          
    <description>An email address to advertise in the HTTP 'From' request
           header and User-Agent header. A good practice is to mangle this
           address (e.g. 'info at example dot com') to avoid spamming.
          
    </description>
        
    </property>

    </configuration>

    注意:在nutch-0.9.jar里面已包含nutch-site.xml,  conf目錄下的文件都復(fù)制過到classpath根下,如果是在WEB環(huán)境下運(yùn)行classpath下的nutch-site.xml會優(yōu)先加載,如果在在Application環(huán)境運(yùn)行,應(yīng)把如上nutch-site.xml打入到nutch-0.9.jar包里,否則,上面的一些屬性為空不能運(yùn)行。


    4、在Windows下運(yùn)行Nutch,很簡單,只要你能執(zhí)行Crawl這個類就行,寫一個Ant腳本放在Nuthc的根目錄下執(zhí)行它就OK,內(nèi)容如下:
    <project name="nutch-crawl" default="crawl" basedir=".">
        
        
    <property name="lib.dir"  location="lib"/>
        
    <property name="conf.dir"  location="conf"/>
        

        
    <path id="project.classpath">
            
    <fileset dir="." includes="nutch-*.jar"/>
            
    <fileset dir="lib" />
            
    <pathelement path="."/>
            
    <pathelement path="${conf.dir}"/>
        
    </path>
        
        
        
    <target name="crawl" >
            
    <echo>crwaling starting</echo>
            
    <property name="JVM.extra.args" value="-Xmx512m" />
            
    <java classname="org.apache.nutch.crawl.Crawl" classpathref="project.classpath" fork="true">
                
    <jvmarg line="${JVM.extra.args}"/>
                
    <arg value="C:/dev-tools/nutch-0.9/urls"/>
                
    <arg value="-dir"/>
                
    <arg value="C:/dev-tools/nutch-0.9/crawl"/>
                
    <arg value="-depth"/>
                
    <arg value="3"/>
                
    <arg value="-threads"/>
                
    <arg value="15"/>
            
    </java>
            
    <echo>crwaling finished</echo>
        
    </target>
        
    </project>

    至此,如無意外,Nutch已經(jīng)歡快地運(yùn)行起來,最后在crawl目錄下你會發(fā)現(xiàn)你想要的東西,Enjoy it!

    posted @ 2007-04-27 11:09 小魚 閱讀(2101) | 評論 (0)編輯 收藏

    僅列出標(biāo)題  
    <2025年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導(dǎo)航

    統(tǒng)計(jì)

    常用鏈接

    留言簿(3)

    我參與的團(tuán)隊(duì)

    隨筆檔案

    文章檔案

    搜索

    最新評論

    主站蜘蛛池模板: 国产亚洲精午夜久久久久久 | 立即播放免费毛片一级| 午夜精品一区二区三区免费视频| 亚洲情a成黄在线观看| 免费精品国产自产拍在线观看| 免费观看日本污污ww网站一区| v片免费在线观看| 免费黄色一级毛片| 亚洲成a人无码亚洲成www牛牛 | 福利片免费一区二区三区| 国产三级免费电影| 一级毛片正片免费视频手机看| 免费又黄又爽又猛的毛片| 一区二区三区免费看| 国产亚洲AV手机在线观看| 色www永久免费| 亚洲黄色三级视频| 久久精品免费全国观看国产| 亚洲一区二区三区丝袜| 午夜爱爱免费视频| 成人特级毛片69免费观看| 亚洲国产一成人久久精品| 50岁老女人的毛片免费观看| 亚洲色成人WWW永久在线观看| 国产乱弄免费视频| 丰满人妻一区二区三区免费视频| 亚洲av无码精品网站| 国产h视频在线观看免费| 色九月亚洲综合网| 日韩亚洲一区二区三区| 国产精品入口麻豆免费观看| 亚洲爆乳AAA无码专区| 亚洲日韩欧洲乱码AV夜夜摸| 免费A级毛片无码专区| 亚洲av日韩av永久在线观看| 亚洲中文字幕无码一久久区| 日韩在线播放全免费| 瑟瑟网站免费网站入口| 亚洲日本中文字幕| 国产免费一区二区三区VR| 免费无码又爽又刺激网站直播|