Documentation ¶
Index ¶
- Constants
- type AuthToken
- type FollowAction
- type GIF
- type Media
- type Mention
- type NewTweet
- type OpenAccount
- type Photo
- type Place
- type ProcessingInfo
- type Profile
- type ProfileResult
- type ScheduledTweet
- type Scraper
- func (s *Scraper) ClearCookies()
- func (s *Scraper) ClearGuestToken() error
- func (s *Scraper) CreateRetweet(tweetId string) (string, error)
- func (s *Scraper) CreateScheduledTweet(schedule TweetSchedule) (string, error)
- func (s *Scraper) CreateTweet(tweet NewTweet) (*Tweet, error)
- func (s *Scraper) DeleteRetweet(tweetId string) error
- func (s *Scraper) DeleteScheduledTweet(id string) error
- func (s *Scraper) DeleteTweet(tweetId string) error
- func (s *Scraper) FetchBookmarks(maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FetchFollowers(user string, maxUsersNbr int, cursor string) ([]*Profile, string, error)
- func (s *Scraper) FetchFollowersByUserID(userID string, maxUsersNbr int, cursor string) ([]*Profile, string, error)
- func (s *Scraper) FetchFollowing(user string, maxUsersNbr int, cursor string) ([]*Profile, string, error)
- func (s *Scraper) FetchFollowingByUserID(userID string, maxUsersNbr int, cursor string) ([]*Profile, string, error)
- func (s *Scraper) FetchForYouTweets(maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FetchHomeTweets(maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FetchMediaTweets(user string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FetchMediaTweetsByUserID(userID string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FetchScheduledTweets() ([]*ScheduledTweet, error)
- 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) FetchTweetsByUserID(userID string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FetchTweetsByUserIDLegacy(userID string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FollowUser(user string, followAction FollowAction) error
- func (s *Scraper) GetBookmarks(ctx context.Context, maxTweetsNbr int) <-chan *TweetResult
- func (s *Scraper) GetCookies() []*http.Cookie
- func (s *Scraper) GetForYouTweets(ctx context.Context, maxTweetsNbr int) <-chan *TweetResult
- func (s *Scraper) GetGuestToken() error
- func (s *Scraper) GetHomeTweets(ctx context.Context, maxTweetsNbr int) <-chan *TweetResult
- func (s *Scraper) GetMediaTweets(ctx context.Context, user string, maxTweetsNbr int) <-chan *TweetResult
- func (s *Scraper) GetProfile(username string) (Profile, error)
- func (s *Scraper) GetProfileByID(userID string) (Profile, error)
- func (s *Scraper) GetSpace(id string) (*Space, error)
- func (s *Scraper) GetTrends() ([]string, error)
- func (s *Scraper) GetTweet(id string) (*Tweet, error)
- func (s *Scraper) GetTweetReplies(id string, cursor string) ([]*Tweet, []*ThreadCursor, error)
- func (s *Scraper) GetTweetRetweeters(tweetId string, maxUsersNbr int, cursor string) ([]*Profile, string, 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) IsLoggedIn() bool
- func (s *Scraper) LikeTweet(tweetId string) error
- func (s *Scraper) Login(credentials ...string) error
- func (s *Scraper) LoginOpenAccount() (OpenAccount, error)
- func (s *Scraper) Logout() error
- 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) SetAuthToken(token AuthToken)
- func (s *Scraper) SetCookies(cookies []*http.Cookie)
- func (s *Scraper) SetProxy(proxyAddr string) error
- func (s *Scraper) SetSearchMode(mode SearchMode) *Scraper
- func (s *Scraper) UnlikeTweet(tweetId string) error
- func (s *Scraper) UploadMedia(filePath string) (*Media, error)
- func (s *Scraper) WithClientTimeout(timeout time.Duration) *Scraper
- func (s *Scraper) WithDelay(seconds int64) *Scraper
- func (s *Scraper) WithOpenAccount(openAccount OpenAccount)
- func (s *Scraper) WithReplies(b bool) *Scraper
- type SearchMode
- type Space
- type SpaceParticipants
- type SpaceUser
- type ThreadCursor
- type Topic
- type Tweet
- type TweetResult
- type TweetSchedule
- type Video
Constants ¶
const DefaultClientTimeout = 10 * time.Second
default http client timeout
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OpenAccount ¶
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 ProcessingInfo ¶
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 Sensitive bool Following bool FollowedBy bool }
Profile of twitter user.
type ScheduledTweet ¶
type Scraper ¶
type Scraper struct {
// contains filtered or unexported fields
}
Scraper object
func (*Scraper) ClearCookies ¶
func (s *Scraper) ClearCookies()
func (*Scraper) ClearGuestToken ¶
func (*Scraper) CreateScheduledTweet ¶
func (s *Scraper) CreateScheduledTweet(schedule TweetSchedule) (string, error)
CreateScheduledTweet schedule new tweet.
func (*Scraper) DeleteRetweet ¶
Retweeted tweets has their own id, but to delete retweet twitter using id of source tweet
func (*Scraper) DeleteScheduledTweet ¶
DeleteScheduledTweet removes tweet from scheduled.
func (*Scraper) DeleteTweet ¶
func (*Scraper) FetchBookmarks ¶
FetchBookmarks gets bookmarked tweets via the Twitter frontend GraphQL API.
func (*Scraper) FetchFollowers ¶
func (s *Scraper) FetchFollowers(user string, maxUsersNbr int, cursor string) ([]*Profile, string, error)
FetchFollowers gets following profiles list for a given user, via the Twitter frontend GraphQL API.
func (*Scraper) FetchFollowersByUserID ¶
func (s *Scraper) FetchFollowersByUserID(userID string, maxUsersNbr int, cursor string) ([]*Profile, string, error)
FetchFollowersByUserID gets followers profiles list for a given userID, via the Twitter frontend GraphQL API.
func (*Scraper) FetchFollowing ¶
func (s *Scraper) FetchFollowing(user string, maxUsersNbr int, cursor string) ([]*Profile, string, error)
FetchFollowing gets following profiles list for a given user, via the Twitter frontend GraphQL API.
func (*Scraper) FetchFollowingByUserID ¶
func (s *Scraper) FetchFollowingByUserID(userID string, maxUsersNbr int, cursor string) ([]*Profile, string, error)
FetchFollowingByUserID gets following profiles list for a given userID, via the Twitter frontend GraphQL API.
func (*Scraper) FetchForYouTweets ¶
func (*Scraper) FetchHomeTweets ¶
func (*Scraper) FetchMediaTweets ¶
func (s *Scraper) FetchMediaTweets(user string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
FetchMediaTweets gets tweets with medias for a given user, via the Twitter frontend API.
func (*Scraper) FetchMediaTweetsByUserID ¶
func (s *Scraper) FetchMediaTweetsByUserID(userID string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
FetchMediaTweetsByUserID gets tweets with medias for a given userID, via the Twitter frontend GraphQL API.
func (*Scraper) FetchScheduledTweets ¶
func (s *Scraper) FetchScheduledTweets() ([]*ScheduledTweet, error)
FetchScheduledTweets gets scheduled tweets via the Twitter frontend GraphQL API.
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) FetchTweetsByUserID ¶
func (s *Scraper) FetchTweetsByUserID(userID string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
FetchTweetsByUserID gets tweets for a given userID, via the Twitter frontend GraphQL API.
func (*Scraper) FetchTweetsByUserIDLegacy ¶
func (s *Scraper) FetchTweetsByUserIDLegacy(userID string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
FetchTweetsByUserIDLegacy gets tweets for a given userID, via the Twitter frontend legacy API.
func (*Scraper) FollowUser ¶
func (s *Scraper) FollowUser(user string, followAction FollowAction) error
func (*Scraper) GetBookmarks ¶
func (s *Scraper) GetBookmarks(ctx context.Context, maxTweetsNbr int) <-chan *TweetResult
GetBookmarks returns channel with tweets from user bookmarks.
func (*Scraper) GetCookies ¶
func (*Scraper) GetForYouTweets ¶
func (s *Scraper) GetForYouTweets(ctx context.Context, maxTweetsNbr int) <-chan *TweetResult
GetForYouTweets returns channel with tweets from for you timeline
func (*Scraper) GetGuestToken ¶
GetGuestToken from Twitter API
func (*Scraper) GetHomeTweets ¶
func (s *Scraper) GetHomeTweets(ctx context.Context, maxTweetsNbr int) <-chan *TweetResult
GetHomeTweets returns channel with tweets from home timeline
func (*Scraper) GetMediaTweets ¶
func (s *Scraper) GetMediaTweets(ctx context.Context, user string, maxTweetsNbr int) <-chan *TweetResult
GetTweets returns channel with tweets for a given user.
func (*Scraper) GetProfile ¶
GetProfile return parsed user profile.
func (*Scraper) GetTweetReplies ¶
func (*Scraper) GetTweetRetweeters ¶
func (*Scraper) GetUserIDByScreenName ¶
GetUserIDByScreenName from API
func (*Scraper) IsGuestToken ¶
IsGuestToken check if guest token not empty
func (*Scraper) IsLoggedIn ¶
IsLoggedIn check if scraper logged in
func (*Scraper) Login ¶
Login to Twitter Use Login(username, password) for ordinary login or Login(username, password, email) for login if you have email confirmation or Login(username, password, code_for_2FA) for login if you have two-factor authentication
func (*Scraper) LoginOpenAccount ¶
func (s *Scraper) LoginOpenAccount() (OpenAccount, error)
LoginOpenAccount as Twitter app
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) SetAuthToken ¶
Auth using auth_token and ct0 cookies
func (*Scraper) SetCookies ¶
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) UnlikeTweet ¶
func (*Scraper) UploadMedia ¶
Uploads photo, video or gif for further posting or scheduling. Expires in 24 hours if not used.
func (*Scraper) WithClientTimeout ¶
client timeout
func (*Scraper) WithOpenAccount ¶
func (s *Scraper) WithOpenAccount(openAccount OpenAccount)
func (*Scraper) WithReplies ¶
WithReplies enable/disable load timeline with tweet replies
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 SpaceParticipants ¶
type ThreadCursor ¶
type Tweet ¶
type Tweet struct { ConversationID string GIFs []GIF HTML string ID string InReplyToStatus *Tweet InReplyToStatusID string IsQuoted bool IsPin bool IsReply bool IsRetweet bool IsSelfThread bool Likes int Name string Mentions []Mention PermanentURL string Photos []Photo Place *Place QuotedStatus *Tweet QuotedStatusID string Replies int Retweets int RetweetedStatus *Tweet RetweetedStatusID string Text string Thread []*Tweet TimeParsed time.Time Timestamp int64 URLs []string UserID string Username string Videos []Video Views int SensitiveContent bool }
Tweet type.