Having difficulty navigating webpages using rvest package

跟風遠走 提交于 2019-12-10 23:24:40

问题


I am having real difficulty with the rvest package in R. I am trying to navigate to a particular webpage after hitting an "I Agree" button on the first webpage. Here's the link to the webpage that I begin with. The code below attempts to obtain the next webpage which has a form to fill out in order to obtain data that I will need to extract.

url <- "http://wonder.cdc.gov/mcd-icd10.html"
pgsession <- html_session(url)
pgform <- html_form(pgsession)[[3]]
new_session <- html_session(submit_form(pgsession,pgform)$url)
pgform_new <- html_form(new_session)

The last line does not obtain the html form for the next webpage and gives me the following error in R.

Error in read_xml.response(x$response, ..., as_html = as_html) : 
server error: (500) Internal Server Error

Would very much appreciate any help that I can get with this in both getting to the next webpage and also submitting a form to obtain data. Thanks so much for your time!

来源:https://stackoverflow.com/questions/39779004/having-difficulty-navigating-webpages-using-rvest-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!