Documentation ¶
Index ¶
- Constants
- func GetTrends() ([]string, error)deprecated
- func GetTweets(ctx context.Context, user string, maxTweetsNbr int) <-chan *TweetResultdeprecated
- func SearchProfiles(ctx context.Context, query string, maxProfilesNbr int) <-chan *ProfileResultdeprecated
- func SearchTweets(ctx context.Context, query string, maxTweetsNbr int) <-chan *TweetResultdeprecated
- func SetProxy(proxy string) errordeprecated
- type Place
- type Profile
- type ProfileResult
- type Scraper
- func (s *Scraper) FetchSearchProfiles(query string, maxProfilesNbr int, cursor string) ([]*Profile, string, error)
- func (s *Scraper) FetchSearchTweets(query string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FetchTweets(user string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) GetGuestToken() error
- func (s *Scraper) GetProfile(username string) (Profile, error)
- func (s *Scraper) GetTrends() ([]string, error)
- func (s *Scraper) GetTweet(id string) (*Tweet, error)
- func (s *Scraper) GetTweets(ctx context.Context, user string, maxTweetsNbr int) <-chan *TweetResult
- func (s *Scraper) GetUserIDByScreenName(screenName string) (string, error)
- func (s *Scraper) IsGuestToken() bool
- func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error
- func (s *Scraper) SearchProfiles(ctx context.Context, query string, maxProfilesNbr int) <-chan *ProfileResult
- func (s *Scraper) SearchTweets(ctx context.Context, query string, maxTweetsNbr int) <-chan *TweetResult
- func (s *Scraper) SetProxy(proxyAddr string) error
- func (s *Scraper) SetSearchMode(mode SearchMode) *Scraper
- func (s *Scraper) WithClientTimeout(timeout time.Duration) *Scraper
- func (s *Scraper) WithCookie(cookie string) *Scraper
- func (s *Scraper) WithDelay(seconds int64) *Scraper
- func (s *Scraper) WithReplies(b bool) *Scraper
- func (s *Scraper) WithXCsrfToken(xcsrfToken string) *Scraper
- type SearchMode
- type Tweet
- func GetTweet(id string) (*Tweet, error)deprecated
- type TweetResult
- type Video
Constants ¶
const DefaultClientTimeout = 10 * time.Second
default http client timeout
Variables ¶
This section is empty.
Functions ¶
func SearchProfiles
deprecated
func SearchProfiles(ctx context.Context, query string, maxProfilesNbr int) <-chan *ProfileResult
Deprecated: SearchProfiles wrapper for default Scraper
func SearchTweets
deprecated
func SearchTweets(ctx context.Context, query string, maxTweetsNbr int) <-chan *TweetResult
Deprecated: SearchTweets wrapper for default Scraper
Types ¶
type Place ¶
type Place struct { ID string `json:"id"` PlaceType string `json:"place_type"` Name string `json:"name"` FullName string `json:"full_name"` CountryCode string `json:"country_code"` Country string `json:"country"` BoundingBox struct { Type string `json:"type"` Coordinates [][][]float64 `json:"coordinates"` } `json:"bounding_box"` }
type Profile ¶
type Profile struct { Avatar string Banner string Biography string Birthday string FollowersCount int FollowingCount int FriendsCount int IsPrivate bool IsVerified bool Joined *time.Time LikesCount int ListedCount int Location string Name string PinnedTweetIDs []string TweetsCount int URL string UserID string Username string Website string }
Profile of twitter user.
func GetProfile
deprecated
type Scraper ¶
type Scraper struct {
// contains filtered or unexported fields
}
Scraper object
func SetSearchMode
deprecated
func SetSearchMode(mode SearchMode) *Scraper
Deprecated: SetSearchMode wrapper for default Scraper
func WithReplies
deprecated
func (*Scraper) FetchSearchProfiles ¶
func (s *Scraper) FetchSearchProfiles(query string, maxProfilesNbr int, cursor string) ([]*Profile, string, error)
FetchSearchProfiles gets users for a given search query, via the Twitter frontend API
func (*Scraper) FetchSearchTweets ¶
func (s *Scraper) FetchSearchTweets(query string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
FetchSearchTweets gets tweets for a given search query, via the Twitter frontend API
func (*Scraper) FetchTweets ¶
func (s *Scraper) FetchTweets(user string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
FetchTweets gets tweets for a given user, via the Twitter frontend API.
func (*Scraper) GetGuestToken ¶
GetGuestToken from Twitter API
func (*Scraper) GetProfile ¶
GetProfile return parsed user profile.
func (*Scraper) GetUserIDByScreenName ¶
GetUserIDByScreenName from API
func (*Scraper) IsGuestToken ¶
IsGuestToken check if guest token not empty
func (*Scraper) RequestAPI ¶
RequestAPI get JSON from frontend API and decodes it
func (*Scraper) SearchProfiles ¶
func (s *Scraper) SearchProfiles(ctx context.Context, query string, maxProfilesNbr int) <-chan *ProfileResult
SearchProfiles returns channel with profiles for a given search query
func (*Scraper) SearchTweets ¶
func (s *Scraper) SearchTweets(ctx context.Context, query string, maxTweetsNbr int) <-chan *TweetResult
SearchTweets returns channel with tweets for a given search query
func (*Scraper) SetProxy ¶
SetProxy set http proxy in the format `http://HOST:PORT` set socket proxy in the format `socks5://HOST:PORT`
func (*Scraper) SetSearchMode ¶
func (s *Scraper) SetSearchMode(mode SearchMode) *Scraper
SetSearchMode switcher
func (*Scraper) WithClientTimeout ¶
client timeout
func (*Scraper) WithReplies ¶
WithReplies enable/disable load timeline with tweet replies
func (*Scraper) WithXCsrfToken ¶
x csrf token
type SearchMode ¶
type SearchMode int
SearchMode type
const ( // SearchTop - default mode SearchTop SearchMode = iota // SearchLatest - live mode SearchLatest // SearchPhotos - image mode SearchPhotos // SearchVideos - video mode SearchVideos // SearchUsers - user mode SearchUsers )
type Tweet ¶
type Tweet struct { HTML string ID string InReplyToStatus *Tweet IsQuoted bool IsPin bool IsReply bool IsRetweet bool Likes int PermanentURL string Photos []string Place *Place QuotedStatus *Tweet Replies int Retweets int RetweetedStatus *Tweet Text string TimeParsed time.Time Timestamp int64 URLs []string UserID string Username string Videos []Video SensitiveContent bool }
Tweet type.