【发布时间】:2020-10-18 10:11:11
【问题描述】:
你好,我是这个迷人的 r 世界的新手,我无法跳过不存在的 url,我该如何处理?并且不要标记为和错误,感谢您的帮助。
标题:“错误” 作者:《FJSG》 日期:“2020 年 6 月 27 日” 输出:html_document
knitr::opts_chunk$set(echo = TRUE)
库(xml2)
图书馆(rvest)
图书馆(tidyverse)
图书馆(润滑)
zora_core %
html_text() %>%
str_trim(side = "both"),
解释 = html_nodes(zora_core, "强 em , p#73e0 强") %>%
html_text() %>%
str_remove_all("^by") %>%
str_extract("[a-zA-Z].+(?=[(])") %>% str_trim(side = "both"),
año = html_nodes(zora_core, "strong em , p#73e0 strong") %>%
html_text %>%
str_extract("([[:digit:]]){4}"),
liga = paste0("https://en.wikipedia.org/wiki/",html_nodes(zora_core, "strong em , p#73e0 strong") %>%
html_text() %>%
str_remove_all("^by") %>%
str_extract("[a-zA-Z].+(?=[(])") %>% str_trim(side = "both") %>% str_replace_all(" ","_")))
货物 %
html_text() %>% str_trim(side = "both"))
}
lista
【问题讨论】:
标签: r web-scraping http-status-code-404 handleerror