我正在尝试使用 XML、RCurl 包来读取以下 URL http://www.nse-india.com/marketinfo/equities/cmquote.jsp?key=SBINEQN&symbol=SBIN&flag=0&series=EQ#的一些 html 表
这是我正在使用的代码
library(RCurl)
library(XML)
options(RCurlOptions = list(useragent = "R"))
url <- "http://www.nse-india.com/marketinfo/equities/cmquote.jsp?key=SBINEQN&symbol=SBIN&flag=0&series=EQ#"
wp <- getURLContent(url)
doc <- htmlParse(wp, asText = TRUE)
docName(doc) <- url
tmp <- readHTMLTable(doc)
## Required tables
tmp[[13]]
tmp[[14]]
如果您查看表格,则无法解析网页中的值。我猜这是由于一些 javascipt 评估在运行中发生的。现在,如果我在 google chrome 中使用“将页面另存为”选项(它在 mozilla 中不起作用)并保存页面,然后使用上面的代码,我就可以读取这些值。
但是有没有办法让我可以阅读苍蝇表?如果您能提供帮助,那就太好了。
问候,