Hey, @Stella. I get the same error whenever I run too many automated Google queries within a short time period (which tends to vary).
I finally got around this by using SerpAPI, which acts as a middleman when automating queries for most search engines. It's a subscription-based service ($50/mo), but you can cancel at will. SerpAPI works every time for me. Good luck!