Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
Ensure that tasks are >= zero, otherwise we can assume we have been r…
Browse files Browse the repository at this point in the history
…atelimited
  • Loading branch information
JustTalDevelops committed Nov 19, 2021
1 parent ea2e0e4 commit b111e47
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,12 @@ func (c *Challenge) requestCaptcha() error {
c.category = response.Get("request_type").String()
c.question = response.Get("requester_question").Get("en").String()

for index, task := range response.Get("tasklist").Array() {
tasks := response.Get("tasklist").Array()
if len(tasks) == 0 {
return fmt.Errorf("no tasks in challenge, most likely ratelimited")
}

for index, task := range tasks {
resp, err = http.Get(task.Get("datapoint_uri").String())
if err != nil {
return err
Expand Down

0 comments on commit b111e47

Please sign in to comment.