Java Nutch没有解析整个网站,只有第一个URL

Java Nutch没有解析整个网站,只有第一个URL,java,nutch,Java,Nutch,我试图使用NutchFetcher获取整个网站,但它只加载第一个URL: import org.apache.nutch.fetcher.Fetcher; new Fetcher(conf).fetch(segment, 1); 这是我在日志中看到的: [INFO] org.apache.nutch.fetcher.Fetcher: Fetcher: starting at 2019-03-29 00:11:47 [INFO] org.apache.nutch.fetcher.Fetcher:

我试图使用Nutch
Fetcher
获取整个网站,但它只加载第一个URL:

import org.apache.nutch.fetcher.Fetcher;
new Fetcher(conf).fetch(segment, 1);
这是我在日志中看到的:

[INFO] org.apache.nutch.fetcher.Fetcher: Fetcher: starting at 2019-03-29 00:11:47
[INFO] org.apache.nutch.fetcher.Fetcher: Fetcher: segment: /var/folders/vl/633jwjvn2jvbj9zfg1sgglhw0000gp/T/1198814103175176756/segments/20190329001146
[WARN] org.apache.hadoop.mapreduce.JobResourceUploader: Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
[INFO] org.apache.nutch.fetcher.FetchItemQueues: Using queue mode : byHost
[INFO] org.apache.nutch.fetcher.Fetcher: Fetcher: threads: 1
[INFO] org.apache.nutch.fetcher.Fetcher: Fetcher: time-out divisor: 2
[INFO] org.apache.nutch.fetcher.QueueFeeder: QueueFeeder finished: total 1 records hit by time limit : 0
[INFO] org.apache.nutch.net.URLExemptionFilters: Found 0 extensions at point:'org.apache.nutch.net.URLExemptionFilter'
[INFO] org.apache.nutch.fetcher.FetcherThread: FetcherThread 129 Using queue mode : byHost
[INFO] org.apache.nutch.fetcher.Fetcher: Fetcher: throughput threshold: -1
[INFO] org.apache.nutch.fetcher.Fetcher: Fetcher: throughput threshold retries: 5
[INFO] org.apache.nutch.fetcher.FetcherThread: FetcherThread 133 fetching http://www.zerocracy.com/ (queue crawl delay=5000ms)
[INFO] org.apache.nutch.protocol.RobotRulesParser: robots.txt whitelist not configured.
[INFO] org.apache.nutch.protocol.http.Http: http.proxy.host = null
[INFO] org.apache.nutch.protocol.http.Http: http.proxy.port = 8080
[INFO] org.apache.nutch.protocol.http.Http: http.proxy.exception.list = false
[INFO] org.apache.nutch.protocol.http.Http: http.timeout = 10000
[INFO] org.apache.nutch.protocol.http.Http: http.content.limit = 65536
[INFO] org.apache.nutch.protocol.http.Http: http.agent = yc/Nutch-1.15
[INFO] org.apache.nutch.protocol.http.Http: http.accept.language = en-us,en-gb,en;q=0.7,*;q=0.3
[INFO] org.apache.nutch.protocol.http.Http: http.accept = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[INFO] org.apache.nutch.protocol.http.Http: http.enable.cookie.header = true
[INFO] org.apache.nutch.fetcher.FetcherThread: FetcherThread 133 has no more work available
[INFO] org.apache.nutch.fetcher.FetcherThread: FetcherThread 133 -finishing thread FetcherThread, activeThreads=0
[INFO] org.apache.nutch.fetcher.Fetcher: -activeThreads=0, spinWaiting=0, fetchQueues.totalSize=0, fetchQueues.getQueueCount=0
[INFO] org.apache.nutch.fetcher.Fetcher: -activeThreads=0
[INFO] org.apache.nutch.fetcher.Fetcher: Fetcher: finished at 2019-03-29 00:11:49, elapsed: 00:00:02

我错过了什么?这是Nutch 1.15。

获取程序类只负责使用配置的线程数获取/下载段中存在的URL。这就意味着获取程序不会解析或从获取的内容中提取URL。
fetch
方法仅下载内容,仅此而已。对于您的用例,您需要自己解析HTML内容(或者使用
org/apache/nutch/parse
工具),并生成一个新的段来获取新发现的链接


这就是Nutch通常的工作方式,您可以提供一个或多个种子URL。将获取/解析此URL,并存储新发现的链接以供下一次迭代。

使用配置的线程数,
获取程序
类仅负责获取/下载段中存在的URL。这就意味着获取程序不会解析或从获取的内容中提取URL。
fetch
方法仅下载内容,仅此而已。对于您的用例,您需要自己解析HTML内容(或者使用
org/apache/nutch/parse
工具),并生成一个新的段来获取新发现的链接


这就是Nutch通常的工作方式,您可以提供一个或多个种子URL。这些URL将被获取/解析,新发现的链接将被存储以供下一次迭代使用。

Hm。。。听起来有点奇怪。我将有多少次迭代?你能提供一个链接到一些解释这个概念的教程吗?到目前为止,我看到的所有文章都建议我做generate+fetch+parse+dump,就这样。一次迭代,整个网站都应该在这里。确切地说,您描述的是正常的循环:生成/获取/解析/更新,这就是
bin/crawl
脚本所做的()。问题在于获取只是下载内容的步骤,仅此而已。从原始HTML中提取链接发生在
parse
步骤中,然后crawldb被更新,新链接可以经历相同的周期。还有一件事,在一个周期内完成整个网站是非常困难的。甚至在多次循环中也没有。Nutch无法知道在一个网站上会找到多少链接。这是通过指定要获取多少URL或爬网的“深度”来限制的。嗯。。。听起来有点奇怪。我将有多少次迭代?你能提供一个链接到一些解释这个概念的教程吗?到目前为止,我看到的所有文章都建议我做generate+fetch+parse+dump,就这样。一次迭代,整个网站都应该在这里。确切地说,您描述的是正常的循环:生成/获取/解析/更新,这就是
bin/crawl
脚本所做的()。问题在于获取只是下载内容的步骤,仅此而已。从原始HTML中提取链接发生在
parse
步骤中,然后crawldb被更新,新链接可以经历相同的周期。还有一件事,在一个周期内完成整个网站是非常困难的。甚至在多次循环中也没有。Nutch无法知道在一个网站上会找到多少链接。这可以通过指定要获取多少URL或爬网的“深度”来限制。