r - Why 'Error: length(url) == 1 is not TRUE' with rvest web scraping -


i'm trying scrap web data first step requires login. i've been able log other websites weird error website.

library("rvest") library("magrittr")      research <- html_session("https://www.fitchratings.com/")  signin <- research %>%   html_nodes("form") %>%   extract2(1) %>%   html_form() %>%   set_values (     'username' = "abc",     'password' = "1234"      )  research <- research %>%   submit_form(signin) 

when run 'submit_form' line following error:

> research <- research %>% + submit_form(signin) submitting '<unnamed>' error: length(url) == 1 not true 

submitting unnamed correct b/c there no name assigned sign in button. appreciated!

i having same issue. jumped through few hoops dev version of rvest running, , it's working smoothly now. here's how went it:

first thing first. need install rtools. make sure r closed out. can found here: https://cran.r-project.org/bin/windows/rtools/. , information installation of rtools can found here (if you're using windows): github.com/stan-dev/rstan/wiki/install-rtools-for-windows

boot r, install libraries "httr" , "rcpp" if don't have them already.

install "devtools" , correlated github installer. information can found here, i'll give quick summary linked repo.

windows:

install.packages("devtools") library(devtools) build_github_devtools()  #### restart r before continuing #### install.packages("devtools.zip", repos = null, type = "source")  # remove package after installation unlink("devtools.zip") 

mac/linux:

devtools::install_github("hadley/devtools") 

now, run final steps.

library(httr) library(rcpp) library(devtools) install_github("hadley/rvest") 

you should able run submit_form(session, form) , not experience error

submitting 'xxxx' error: length(url) == 1 not true 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -