Skip to content

Commit

Permalink
Parallelism added to colly
Browse files Browse the repository at this point in the history
This is a fix for the "Too many requests" error
  • Loading branch information
JacobHepworth authored Jul 11, 2020
1 parent 404559d commit 2a37bd5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2a37bd5

Please sign in to comment.