I'm trying to scrape some information from Google Trends. But every time that I try to get some data I receive the error Too Many Requests. Other sites are ok.
My code:
func Teste(searchTrend string) {
searchTrend = strings.Trim(searchTrend, " ")
searchTrend = strings.Replace(searchTrend, " ", "%20", -1)
linkTrends := ("https://trends.google.com.br/trends/explore?geo=BR&q=" + searchTrend)
c := colly.NewCollector()
c.SetRequestTimeout(120 * time.Second)
c.OnRequest(func(r *colly.Request) {
fmt.Println("Scraping:", r.URL)
})
c.OnResponse(func(r *colly.Response) {
fmt.Println("Status:", r.StatusCode)
})
c.OnError(func(r *colly.Response, e error) {
log.Println("error:", e, r.Request.URL, string(r.Body))
})
c.OnHTML("div.widget-template", func(h *colly.HTMLElement) {
...
})
c.Visit(linkTrends)
}
The error: That’s an error.
We're sorry, but you have sent too many requests to us recently. Please try again later. That’s all we know.