我需要从网上刮html表使用R。有一个1000行的每页一个表,总共有316页。第一个url的链接在这里:“http://sumodb.sumogames.de/Query.aspx?show_form=0&columns=6&rowcount=5&showheya=on&showshusshin=on&showbirthdate=on&showhatsu=on&showintai=on&showheight=on&showweight=on&showhighest=on”
然后我认为只有偏移量在其他urls上递增(1000,2000,3000...,316000
这是我到目前为止在一个页面上工作的代码:
library(XML)
library(rvest)
url <- read_html("http://sumodb.sumogames.de/Query.aspx?show_form=0&columns=6&rowcount=5&showheya=on&showshusshin=on&showbirthdate=on&showhatsu=on&showintai=on&showheight=on&showweight=on&showhighest=on")
table <- url %>%
html_nodes(".record") %>%
html_table(fill = TRUE)
table
大表的每个页面上的css选择器是".record“。
最终目标是将整个表放在一个CSV文件中。
https://stackoverflow.com/questions/44671351
复制相似问题