2014-07-13 117 views
4

我用nutch做了一些实验来抓取没有任何ajax调用的网站,并且我得到了所有的数据。Nutch 2.x没有抓取像flipkart和jabong这样的网站

我执行以下步骤来获取数据。

  1. 用户@本地:〜/样品/ Nutch的/运行/ local/bin目录$ ./nutch注入/path/to/the/seed.txt
  2. $:./nutch产生-batchId 321
  3. $:./nutch取321
  4. $:./nutch解析321
  5. $:./nutch updatedb的

我的HBase作为存储在HDFS文件的存储。如果我执行这些5个步骤它给了我所有的数据,如果该URL是http://www.naaptol.com/brands/nokia/mobile-phones.html但如果我将其更改为http://www.flipkart.com/mens-footwear/shoes/sports-shoes/pr?sid=osp,cil,nit,1cu&otracker=hp_nmenu_sub_men_0_Sports%20Shoes它给我什么

我的nutch-site.xml文件:

<?xml version="1.0"?> 
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> 

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

<configuration> 
     <property> 
       <name>storage.data.store.class</name> 
       <value>org.apache.gora.hbase.store.HBaseStore</value> 
       <description>Default class for storing data</description> 
     </property> 
     <property> 
       <name>http.agent.name</name> 
       <value>com.datametica.agent</value> 
       <description>this is just an agent name</description> 
     </property> 
     <property> 
       <name>http.robots.agents</name> 
       <value>datametica_robot</value> 
       <description>this is just a robot</description> 
     </property> 
     <property> 
       <name>plugin.folders</name> 
       <value>/home/sachin/source_codes/svn/nutch/nutch_2.x/build/plugins</value> 
     </property> 
</configuration> 

回答

3

的regex- urlfilter块网址具有查询字符串参数:

跳过包含某些字符作为可能的查询网址等

-

[* @ =?!] 10

修改该文件,以便与查询字符串参数抓取网址:

跳过含有特定字符作为可能的查询网址等

- [* @!]

Nutch的可能缺少爬行支持Ajax页面。见this

你也许可以看看 https://issues.apache.org/jira/browse/NUTCH-1323

+0

感谢的人它的工作原理,但我当我运行Nutch的是你获得的数据,但在HTTP的情况下,而不是HTML多了一个问题://www.flipkart。 com /男装鞋/鞋/运动鞋/ pr?sid = osp,cil,nit,1cu&otracker = hp_nmenu_sub_men_0_Sports%20鞋子,但它给我的html内容http://www.naaptol.com/brands/nokia/ mobile-phones.html让我知道,如果你知道的东西。 – saching

+0

Sachin,你必须接受别人给出的答案。你可以根据你的需要询问很多问题。但是,如果你给那些已经回答你的问题的人提供一些信用,这将会很好。 –