Hi @nirgrahamuk,
Thanks at first for the help.
Whith this function I was trying to close the function of scrape_mail every time the function reads one url. Without this can't get any result and the code stuck loading.
## función eurodiputados
eurodiputados_funcion <- function(page_url){
page_html <- read_html(page_url)
topic_names <- page_html %>%
html_nodes(css = ".t-y-block") %>%
html_text() %>%
str_squish()
topic_urls <- page_html %>%
html_nodes(css=".t-y-block") %>%
html_attr(name = "href")
tibble(topic=topic_names, topic_url=topic_urls)
}
## Funcion emails
scrape_mail <- function(topic_url) {
topic_html <- read_html(topic_url)
topic_html %>%
html_nodes(css="link_email mr-2") %>%
html_text() %>%
str_squish()
}
page_ulrs <- c("https://www.europarl.europa.eu/meps/es/full-list/all",paste0("https://www.europarl.europa.eu/meps/es", 0:200000))
master <- map_dfr(page_ulrs, eurodiputados_funcion) %>%
mutate(content = map_chr(topic_url, scrape_mail))
The outcome is the same
no loop for break/next, jumping to top level
14.
open.connection(x, "rb")
13.
open(x, "rb")
12.
read_xml.connection(con, encoding = encoding, ..., as_html = as_html,
base_url = x, options = options)
11.
read_xml.character(x, encoding = encoding, ..., as_html = TRUE,
options = options)
10.
read_xml(x, encoding = encoding, ..., as_html = TRUE, options = options)
9.
withCallingHandlers(expr, warning = function(w) if (inherits(w,
classes)) tryInvokeRestart("muffleWarning"))
8.
suppressWarnings(read_xml(x, encoding = encoding, ..., as_html = TRUE,
options = options))
7.
read_html.default(page_url)
6.
read_html(page_url)
5.
.f(.x[[i]], ...)
4.
map(.x, .f, ...)
3.
map_dfr(page_ulrs, eurodiputados_funcion)
2.
mutate(., content = map_chr(topic_url, scrape_mail))
1.
map_dfr(page_ulrs, eurodiputados_funcion) %>% mutate(content = map_chr(topic_url,
scrape_mail))