[R] R web-scraping a multiple-level page

Ilio Fornasero |||o|orn@@ero @end|ng |rom hotm@||@com
Wed Apr 10 10:35:23 CEST 2019


Hello.

I am trying to scrape a FAO webpage including multiple links from any of which I would like to collect the "News" part.

Yet, I have done this:

fao_base = 'http://www.fao.org'
fao_second_level = paste0(stem, '/countryprofiles/en/')

all_children = read_html(fao_second_level) %>%
  html_nodes(xpath = '//a[contains(@href, "?iso3=")]/@href') %>%
  html_text %>% paste0(fao_base, .)

Any suggestion on how to go on? I guess with a loop but I didn't have any success, yet.
Thanks

	[[alternative HTML version deleted]]



More information about the R-help mailing list