【R】no applicable method for 'xml_find_all' applied to an object of class "xml_document"
源码:
# 安装依赖包 if (!require(rvest)) { install.packages("rvest") } if (!require(xml2)) { install.packages("xml2") } # 引入 library(rvest) # 正文 stock_code <- "000616" year_code <- "2018" season_code <- "1" url <- paste( "http://quotes.money.164.com/trade/lsjysj_", stock_code, ".html?year=", year_code, "&season=", season_code, sep = "" ) web_page <- read_html(url) web_table <- html_table(web_page, header = TRUE, trim = TRUE, fill = TRUE)
提示:
no applicable method for 'xml_find_all' applied to an object of class "xml_document"
原因:
所要爬取的这个页面,将爬虫相关的方法禁用了。所以爬下来的是一个空的“xml_document”文档,无法进行后续的解析。
本文来自博客园,作者:Margin22,转载请注明原文链接:https://www.cnblogs.com/skyler/p/9887671.html
.Net Core QQ群:26555711