我只是想在这个链接(标题为"积分榜")上抓取第一个表:https://www.fantrax.com/fantasy/league/vu0zoow2kk7bh64k/standings
在这里遵循一些文档和以前的帖子,我尝试过:
data <- read_html("https://www.fantrax.com/fantasy/league/vu0zoow2kk7bh64k/standings")
tables <- data %>% html_table(fill = TRUE)
和
data <- read_html("https://www.fantrax.com/fantasy/league/vu0zoow2kk7bh64k/standings")
tables <- html_nodes(data, "table")
都无法从该页中拾取任何内容- R只是为每个页面显示空白返回。我希望/猜测我只是错过了一些简单的东西。
使用RSelenium
library(RSelenium)
library(dplyr)
library(rvest)
# Launching the browser
rD <- rsDriver(browser="firefox", port=4551L, verbose=F)
remDr <- rD[["client"]]
url = 'https://www.fantrax.com/fantasy/league/vu0zoow2kk7bh64k/standings'
remDr$navigate(url)
# Extracting tables
remDr$getPageSource()[[1]] %>%
read_html() %>%
html_table()