我从其他帖子中看过关于这个错误的所有其他答案,但他们都没有解决我的问题。
我试图以各种方式从这个网站读取html数据:
curl::curl("https://www.usnews.com/best-colleges/rankings/national-universities") %>% read_html()
url <- 'https://www.usnews.com/best-colleges/rankings/national-universities'
url('https://www.usnews.com/best-colleges/rankings/national-universities', "rb")
他们都给了我禁止的错误。我怎么才能解决这个问题?
发布于 2022-09-20 11:15:39
以下是一种可以考虑的方法:
library(RSelenium)
library(rvest)
url <- "https://www.usnews.com/best-colleges/rankings/national-universities"
shell('docker run -d -p 4445:4444 selenium/standalone-firefox')
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
remDr$open()
remDr$navigate(url)
page_Content <- remDr$getPageSource()[[1]]
html <- read_html(page_Content)
发布于 2022-09-20 11:17:28
以下是一种可以考虑的方法:
library(RDCOMClient)
url <- "https://www.usnews.com/best-colleges/rankings/national-universities"
IEApp <- COMCreate("InternetExplorer.Application")
IEApp[['Visible']] <- TRUE
IEApp$Navigate(url)
Sys.sleep(5)
doc <- IEApp$Document()
page_Content <- doc$documentElement()$innerHtml()
html <- read_html(page_Content)
https://stackoverflow.com/questions/73661674
复制相似问题