我想抓取一个新的 stackexchange 网站的主页:https ://webapps.stackexchange.com/ (只有一次,并且只有几个页面,没有什么应该打扰服务器)。如果我想从 stackoverflow 获得它,我知道有一个数据库转储,但是对于新的 stackexchange,它们还不存在。
这就是我想要做的。
第一步:选择网址
URL <- "https://webapps.stackexchange.com/"
第二步:读表
readHTMLTable(URL) # oops, doesn't work - gives NULL
第 2 步:这一次,让我们用 XML 试试吧
htmlTreeParse(URL) # o.k, this reads the data - but it is all in <div> - now what?
所以我能够阅读页面,但现在结构在 div 中。现在如何使用它来创建与 readHTMLTable 相同的东西?