From 2a37bd52198e59081b06d9f6915c1d1879efce4d Mon Sep 17 00:00:00 2001 From: JacobHepworth Date: Sat, 11 Jul 2020 11:26:15 -0600 Subject: [PATCH] Parallelism added to colly This is a fix for the "Too many requests" error --- download/download.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/download/download.go b/download/download.go index a04bde0..a2842c2 100644 --- a/download/download.go +++ b/download/download.go @@ -31,7 +31,8 @@ func main() { for scanner.Scan() { // instantiate default collector - c := colly.NewCollector() + c := colly.NewCollector(colly.MaxDepth(2), colly.Async(true)) + c.Limit(&colly.LimitRule{DomainGlob: "*", Parallelism: 2}) // get the authenticity token c.OnHTML("div.loginV2--login div[class=loginV2__form] input[type=hidden][name=authenticity_token]", func(e *colly.HTMLElement) {