【发布时间】:2015-02-02 12:52:56
【问题描述】:
我使用 XML 包从 this url 获取链接。
# Parse HTML URL
v1WebParse <- htmlParse(v1URL)
# Read links and and get the quotes of the companies from the href
t1Links <- data.frame(xpathSApply(v1WebParse, '//a', xmlGetAttr, 'href'))
虽然这种方法非常有效,但我使用了rvest,并且在解析网络方面似乎比XML 更快。我尝试了html_nodes 和html_attrs,但无法正常工作。
【问题讨论】:
-
rvest使用XML包进行节点提取。它真的不应该更快。
标签: xml r web-scraping rvest