R: simple login on a website

Viewed 545

newbie here. I'm moving first steps in R world and I'm actually trying understand how to login into a website (this is necessary to me to scrape data, but one step at time). I tried to search a lot for a simple question like this but everytime I get really specific questions or particular issues I'm not able to completely understand and I need the basis. So, please excuse me, but since I've searched a lot without results I hope you can help me.

I need to login in this website http://bit.do/#login/admin and stay logged for scraping private data. I tried this way:

library (rvest)

url       <-"http://bit.do/#login/admin"   
pgsession <-html_session(url)               
pgform    <-html_form(pgsession)[[1]]       


filled_form <- set_values(pgform,
'username' = "MY_USERNAME", 
'password' = "MY_PASSWORD")

submit_form(pgsession,filled_form)

But I get:

Submitting with 'NULL'
Error in xml2::url_absolute(form$url, session$url) : 
Not compatible with STRSXP: [type=NULL].
0 Answers
Related