关于使用nutch抓取短URL

时间:2011-01-25 16:35:43

标签: nutch web-crawler short-url

我正在为我的应用程序使用nutch crawler,它需要抓取一组URL,我将这些URL提供给urls目录并仅获取该URL的内容。 我对内部或外部链接的内容不感兴趣。 所以我使用了NUTCH爬虫,并通过将深度设为1来运行爬网命令。

bin/nutch crawl urls -dir crawl -depth 1

Nutch抓取网址并向我提供给定网址的内容。

我正在使用readseg实用程序阅读内容。

bin/nutch readseg -dump crawl/segments/* arjun -nocontent -nofetch -nogenerate -noparse -noparsedata

有了这个,我正在获取网页的内容。

我面临的问题是,如果我提供像

这样的直接网址
http://isoc.org/wp/worldipv6day/
http://openhackindia.eventbrite.com
http://www.urlesque.com/2010/06/11/last-shot-ye-olde-twitter/
http://www.readwriteweb.com/archives/place_your_tweets_with_twitter_locations.php
http://bangalore.yahoo.com/labs/summerschool.html
http://riadevcamp.eventbrite.com
http://www.sleepingtime.org/

然后我就可以获得网页的内容了。 但是,当我将这组URL作为短链接提供时,如

http://is.gd/jOoAa9
http://is.gd/ubHRAF
http://is.gd/GiFqj9
http://is.gd/H5rUhg
http://is.gd/wvKINL
http://is.gd/K6jTNl
http://is.gd/mpa6fr
http://is.gd/fmobvj
http://is.gd/s7uZf***

我无法获取内容。

当我阅读细分时,它没有显示任何内容。请在下面找到从段中读取的转储文件的内容。

*Recno:: 0
URL:: http://is.gd/0yKjO6
CrawlDatum::
Version: 7
Status: 1 (db_unfetched)
Fetch time: Tue Jan 25 20:56:07 IST 2011
Modified time: Thu Jan 01 05:30:00 IST 1970
Retries since fetch: 0
Retry interval: 2592000 seconds (30 days)
Score: 1.0
Signature: null
Metadata: _ngt_: 1295969171407
Content::
Version: -1
url: http://is.gd/0yKjO6
base: http://is.gd/0yKjO6
contentType: text/html
metadata: Date=Tue, 25 Jan 2011 15:26:28 GMT nutch.crawl.score=1.0 Location=http://holykaw.alltop.com/the-twitter-cool-of-a-to-z?tu4=1 _fst_=36 nutch.segment.name=20110125205614 Content-Type=text/html; charset=UTF-8 Connection=close Server=nginx X-Powered-By=PHP/5.2.14
Content:
Recno:: 1
URL:: http://is.gd/1tpKaN
Content::
Version: -1
url: http://is.gd/1tpKaN
base: http://is.gd/1tpKaN
contentType: text/html
metadata: Date=Tue, 25 Jan 2011 15:26:28 GMT nutch.crawl.score=1.0 Location=http://holykaw.alltop.com/fighting-for-women-who-dont-want-a-voice?tu3=1 _fst_=36 nutch.segment.name=20110125205614 Content-Type=text/html; charset=UTF-8 Connection=close Server=nginx X-Powered-By=PHP/5.2.14
Content:
CrawlDatum::
Version: 7
Status: 1 (db_unfetched)
Fetch time: Tue Jan 25 20:56:07 IST 2011
Modified time: Thu Jan 01 05:30:00 IST 1970
Retries since fetch: 0
Retry interval: 2592000 seconds (30 days)
Score: 1.0*

我也试过将nutch-default.xml中的max.redirects属性设置为4,但是dint找到任何进度。 请为我提供这个问题的解决方案。

谢谢和问候, Arjun Kumar Reddy

2 个答案:

答案 0 :(得分:2)

使用nutch 1.2尝试编辑文件 conf / nutch-default.xml
找到 http.redirect.max 并将值更改为至少1而不是默认值0.

<property>
  <name>http.redirect.max</name>
  <value>2</value><!-- instead of 0 -->
  <description>The maximum number of redirects the fetcher will follow when
  trying to fetch a page. If set to negative or 0, fetcher won't immediately
  follow redirected URLs, instead it will record them for later fetching.
  </description>
</property>
祝你好运

答案 1 :(得分:0)

您必须将深度设置为2或更多,因为第一次提取会返回301(或302)代码。在下一次迭代时将遵循重定向,因此您必须允许更深入。

此外,请确保您允许在regex-urlfilter.txt中使用的所有网址

相关问题