I am trying to access the data off of Google Trends. I am using Rselenium
to access my Gmail account; hoping the credentials will increase my quota in terms of daily limits. Unfortunately, after a few scrapes, I receive an error page.onError - msg: ReferenceError: Can't find variable
and was curious on how I can avoid this. I am assuming it has to do with me reaching my daily limits. I also used rvest
and no luck there either. I read a couple of blog posts stating that I have to enable my cookies but I do not know how to do so using Phantomjs.
url <- 'https://www.google.com/trends/fetchComponent?hl=en-US&q=next,geo=US&cid=TOP_QUERIES_0_0'
remDr$navigate(url)
abc <- webElemen02$getPageSource()
top_searches <- read_html(unlist(abc))%>%
html_nodes(xpath='//*[@class="trends-bar-chart-name"]') %>%
html_text(trim=TRUE)