add SearchLive SearchPhotos SearchVideos
This commit is contained in:
parent
c9ba00cad7
commit
7363f676bf
3 changed files with 51 additions and 0 deletions
40
scraper.go
40
scraper.go
|
|
@ -15,6 +15,7 @@ type Scraper struct {
|
|||
client *http.Client
|
||||
guestToken string
|
||||
includeReplies bool
|
||||
searchMode string
|
||||
}
|
||||
|
||||
var defaultScraper *Scraper
|
||||
|
|
@ -26,6 +27,45 @@ func New() *Scraper {
|
|||
}
|
||||
}
|
||||
|
||||
// SetSearchLive enable/disable realtime search
|
||||
func (s *Scraper) SearchLive(srctype bool) *Scraper {
|
||||
if srctype {
|
||||
s.searchMode = "live"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// SetSearchLive wrapper for default SetSearchLive
|
||||
func SearchLive(srctype bool) *Scraper {
|
||||
return defaultScraper.SearchLive(srctype)
|
||||
}
|
||||
|
||||
// SetSearchPhotos filter search for photos only
|
||||
func (s *Scraper) SearchPhotos(srctype bool) *Scraper {
|
||||
if srctype {
|
||||
s.searchMode = "image"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// SetSearchPhotos wrapper for default SetSearchPhotos
|
||||
func SearchPhotos(srctype bool) *Scraper {
|
||||
return defaultScraper.SearchPhotos(srctype)
|
||||
}
|
||||
|
||||
// SetSearchVideos filter search for videos only
|
||||
func (s *Scraper) SearchVideos(srctype bool) *Scraper {
|
||||
if srctype {
|
||||
s.searchMode = "video"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// SetSearchVideos wrapper for default SetSearchVideos
|
||||
func SearchVideos(srctype bool) *Scraper {
|
||||
return defaultScraper.SearchVideos(srctype)
|
||||
}
|
||||
|
||||
// WithReplies enable/disable load timeline with tweet replies
|
||||
func (s *Scraper) WithReplies(b bool) *Scraper {
|
||||
s.includeReplies = b
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue