0
我正在学习如何在R中使用httr
和XML
从网站上刮取信息。我只是为了只有几张表的网站就可以工作,但无法计算出它用于有多个表格的网站。利用亲足球参考以下页面为例:https://www.pro-football-reference.com/boxscores/201609110atl.htmR:在URL中搜刮多个表格
# To get just the boxscore by quarter, which is the first table:
URL = "https://www.pro-football-reference.com/boxscores/201609080den.htm"
URL = GET(URL)
SnapTable = readHTMLTable(rawToChar(URL$content), stringAsFactors=F)[[1]]
# Return the number of tables:
AllTables = readHTMLTable(rawToChar(URL$content), stringAsFactors=F)
length(AllTables)
[1] 2
所以我能刮信息,但由于某些原因,我只能捕捉前两名表了20+的页。为了练习,我试图获得“Starters”表和“官员”表。
我无法将其他表格设置为网站设置或不正确的代码吗?