Vaibhav Vaibhav - 1 month ago 21
R Question

Google Trends in R, error after few tries

I know similar questions have been asked before but I did not find what I was looking for.

I'm using R to pull google trend data

library(gtrendsR)

user <- "XXXXX@gmail.com"
psw <- "xxxxxxxxx"
gconnect(user, psw)
trend <- gtrends(c("abc","xyz","pqr","ist","def"),
start_date = as.Date("2015-11-01"),
end_date = as.Date("2015-12-31"),
#res = "1h",
geo = "US",
cat = "0-18")
trend$trend


We can only search for 5 terms at a time using this method, so wrote a function and which takes a bunch of terms as input and passes them 5 at a time in the above snippet I used Sys.sleep(10) between each iteration , everything was running fine but after running the function for 5-6 times, I started receiving an error that

Error : Not enough search volume. Please change your search terms.


And this was happening for the 'search terms' for which the function was running perfectly fine earlier.

From what I found while searching for it is that google might have placed a quota of some sort, either in terms of 'total requests' sent or 'no. of requests/time duration' sent to their server which places a day ban

I wanted to know the specifics of the quota limit - Is it in terms of no. of search terms queried or number of search terms queried in an interval

Answer

I figured out the limit using trial and error, it's around 180-200 queries, with each query consisting of 4 search terms, that's about 720 words

It starts throwing the above error if you exceed this limit in a day, the counter gets reset every 24hours