0

I am not building an application that depends on constantly querying Google. I constructed a simple function, based off of this, to return the first result of a Google search for a given query. I only want to use it in isolated instances with dataframes of 100-200 lines.

According to this I can do 40 queries per hour for free, so I'm okay spreading my requests across several hours. I'm also not opposed to authenticating beforehand, but I couldn't find what seemed to be the right solution. The closest I found was googleAuthR, but it doesn't seem to have an option for the Google search engine.

I've never tried to do anything like this before, so this is still pretty new to me. All help is appreciated!

pez
  • 15
  • 5
  • So what exactly is your question here? Do you want code that properly spaces out your queries out over a few hours? – MrFlick Apr 10 '18 at 16:20
  • If that's what's needed, I know how to do that. How long would I need to wait between each individual query? – pez Apr 10 '18 at 18:17
  • Set up a `for` loop. If you can only do 40 an hour, then sleep for 1.5 seconds between each loop. Just add `Sys.sleep(1.5)` in the loop to do the pausing. – MrFlick Apr 10 '18 at 18:32
  • The 40 queries an hour thing just came from a random SO poster. I don't know how definitive that is, and I'd rather not risk trying different intervals for fear of being blocked again. Also, if I can only do 40 queries an hour, I need to wait 90 seconds, not 1.5. – pez Apr 10 '18 at 19:46
  • googleAuthR is for authenticated Google APIs, whereas this is more scraping Google results. You may have more joy with the R library rvest, but you will still have to rate limit as suggested above as Google protects against this kind of thing. – MarkeD Apr 25 '18 at 09:34

0 Answers0