Api 连接到url并使用httr或rvest从中提取数据

Api 连接到url并使用httr或rvest从中提取数据,api,web,web-scraping,rvest,httr,Api,Web,Web Scraping,Rvest,Httr,我需要登录此url: url <- "https://somesite.page.com" url它可以由rvest和Rselnium组合完成。但是没有合适的网站,我帮不了你。登录可以通过Rselenium完成,然后您必须应用Rvest。 login <- "user" password <- "fherf45ujv7" (fake) creds <- list( username = login,

我需要登录此url:

url <- "https://somesite.page.com"

url它可以由rvest和Rselnium组合完成。但是没有合适的网站,我帮不了你。登录可以通过Rselenium完成,然后您必须应用Rvest。
login <- "user"
password <- "fherf45ujv7" (fake)
creds <- list(
    username = login,
    password = password
    )
res <- POST(url, body= creds)
access_token <- "124nqwdin53j2" (fake)
url1 <- "https://somesite.page.com/tables/maintable"
res1 <- GET(url1, add_headers(Authorization = paste("Bearer", access_token)))
content <- content(res1, "raw")