Using 'rvest' to extract links Using 'rvest' to extract links r r

Using 'rvest' to extract links


library(rvest)     page <- read_html("http://www.yelp.com/search?find_loc=New+York,+NY,+USA")page %>% html_nodes(".biz-name") %>% html_attr('href')

Hope this would simplify your problem


I also was able to clean the results from above which for me were quite noisy

links <- page %>% html_nodes("a") %>% html_attr("href")

with a simple regex string matching

links <- links[which(regexpr('common-url-element', links) >= 1)].