Using map() in R to apply a list to function for web scraping

You can unlist to get all the fighter_links together and pass it to map function to extract relevant text.

library(rvest)
library(purrr)

fighter_profiles_a<-map(unlist(fighter_links), function(career_data){
  read_html(career_data)%>%
    html_nodes("div ul li")%>%
    html_text() 
})

The text captured at fighter_profiles_a might require some additional cleaning.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top