Remove deprecated functions

Removed global default scraper
This commit is contained in:
Alexander Sheiko 2023-05-11 14:15:56 +03:00
parent 3eb86161ce
commit 66780eb801
5 changed files with 0 additions and 56 deletions

View file

@ -46,8 +46,6 @@ const (
// default http client timeout
const DefaultClientTimeout = 10 * time.Second
var defaultScraper *Scraper
// New creates a Scraper object
func New() *Scraper {
jar, _ := cookiejar.New(nil)
@ -76,33 +74,18 @@ func (s *Scraper) SetSearchMode(mode SearchMode) *Scraper {
return s
}
// Deprecated: SetSearchMode wrapper for default Scraper
func SetSearchMode(mode SearchMode) *Scraper {
return defaultScraper.SetSearchMode(mode)
}
// WithDelay add delay between API requests (in seconds)
func (s *Scraper) WithDelay(seconds int64) *Scraper {
s.delay = seconds
return s
}
// Deprecated: WithDelay wrapper for default Scraper
func WithDelay(seconds int64) *Scraper {
return defaultScraper.WithDelay(seconds)
}
// WithReplies enable/disable load timeline with tweet replies
func (s *Scraper) WithReplies(b bool) *Scraper {
s.includeReplies = b
return s
}
// Deprecated: WithReplies wrapper for default Scraper
func WithReplies(b bool) *Scraper {
return defaultScraper.WithReplies(b)
}
// client timeout
func (s *Scraper) WithClientTimeout(timeout time.Duration) *Scraper {
s.client.Timeout = timeout
@ -149,12 +132,3 @@ func (s *Scraper) SetProxy(proxyAddr string) error {
}
return errors.New("only support http(s) or socks5 protocol")
}
// Deprecated: SetProxy wrapper for default Scraper
func SetProxy(proxy string) error {
return defaultScraper.SetProxy(proxy)
}
func init() {
defaultScraper = New()
}