How to get google search results

If you look at the htmlvariable, you can see that the search result links all are nested in <h3 class=”r”> tags. Try to change your getGoogleLinks function to: getGoogleLinks <- function(google.url) { doc <- getURL(google.url, httpheader = c(“User-Agent” = “R (2.10.0)”)) html <- htmlTreeParse(doc, useInternalNodes = TRUE, error=function (…){}) nodes <- getNodeSet(html, “//h3[@class=”r”]//a”) return(sapply(nodes, function(x) … Read more