首页 > 解决方案 > 一个节点产生错误:已达到超时:[www.website.com] 连接在 10001 毫秒后超时

问题描述

我正在尝试使用以下代码进行网络抓取,但我遇到了错误。

table_desc<-function(links){descriptions<-read_html(link_to_stats_tables[links])%>%html_nodes("[class='content-footer']")%>%html_nodes('p')%>%html_text()}

cores=detectCores()
cl <- makeCluster(cores)
clusterExport(cl,c("%>%","read_html","html_nodes","html_table","html_text","table_desc"))
system.time(alltables<-parLapply(cl,1:length(link_to_stats_tables),table_desc))
stopCluster(cl)

当我尝试只抓取少量文本时它工作正常,但我们在更大范围内运行它,它会吐出以下错误。

Error in checkForRemoteErrors(val) : 
  one node produced an error: Timeout was reached: [www.website.com] Connection timed out after 10001 milliseconds
Timing stopped at: 0.09 0.14 4124

任何人都可以帮我解决这个问题吗?

标签: rweb-scrapingparallel-processingscreen-scrapingrvest

解决方案


推荐阅读