forked from rocketlaunchr/google-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlimit.go
22 lines (17 loc) · 770 Bytes
/
limit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright 2020-22 PJ Engineering and Business Solutions Pty. Ltd. All rights reserved.
package googlesearch
import (
"errors"
"golang.org/x/time/rate"
)
// ErrBlocked indicates that Google has detected that you were scraping and temporarily blocked you.
// The duration of the block is unspecified.
//
// See: https://github.com/chrisjoyce911/google-search#warning-warning
var ErrBlocked = errors.New("google block")
// RateLimit sets a global limit to how many requests to Google Search can be made in a given time interval.
// The default is unlimited (but obviously Google Search will block you temporarily if you do too many
// calls too quickly).
//
// See: https://godoc.org/golang.org/x/time/rate#NewLimiter
var RateLimit = rate.NewLimiter(rate.Inf, 0)