Google Trends in R, error after few tries

好久不见. 提交于 2019-12-11 02:12:01

问题


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


回答1:


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




回答2:


I think the problem is at google's end. If you open the download page, it sometimes reports the following:

Sorry, our systems are a little stressed out right now and need to take a deep breath. Please try again in a few moments.

Just try running your code again.



来源:https://stackoverflow.com/questions/39568710/google-trends-in-r-error-after-few-tries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!