Hi Rstudio comunity
I am trying to scrab the emails from all the diputies of the european parlaments with their names and parlament URL.
For this I create two functions to aplicate for each of the URLs of the diputies.
## 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()
close(scrape_mail)
}
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 problem is that I get this error that I can't fix.
no loop for break/next, jumping to top level
I am stuck
thanks