Html 解析";“形式行动”;在R中的网页的属性
我正试着跟着这条路走 我已Html 解析";“形式行动”;在R中的网页的属性,html,r,xml,Html,R,Xml,我正试着跟着这条路走 我已POSTed我的API密钥: tgt <- POST( url = "https://utslogin.nlm.nih.gov/cas/v1/api-key", encode = "form", body = list("apikey" = "SECRET") ) tgt.page <- read_html(rawToChar(tgt$content))
POST
ed我的API密钥:
tgt <-
POST(
url = "https://utslogin.nlm.nih.gov/cas/v1/api-key", encode = "form",
body = list("apikey" = "SECRET")
)
tgt.page <- read_html(rawToChar(tgt$content))
我还必须导入XML
或xml2
并使用它们的函数之一吗?这将提取“action”属性:
tgt <-
html_attr(html_nodes(x = tgt.page, xpath = "//form"), "action")
tgt
html_nodes(x = tgt.page, xpath = "//form")
tgt <-
html_attr(html_nodes(x = tgt.page, xpath = "//form"), "action")
st.req <-
POST(
url = tgt, encode = "form",
body = list("service" = "http://umlsks.nlm.nih.gov")
)
st <- rawToChar(st.req$content)