Documentation
¶
Index ¶
- Constants
- type Account
- type AccountList
- type AccountSettings
- type AuthToken
- type ExtendedMedia
- type GIF
- type Media
- type Mention
- type NewTweet
- type OpenAccount
- type Photo
- type Place
- type ProcessingInfo
- type Professional
- 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) FetchTweetsAndReplies(user string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
- func (s *Scraper) FetchTweetsAndRepliesByUserID(userID string, maxReplysNbr 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) GetAccountList() ([]Account, error)
- func (s *Scraper) GetAccountSettings() (AccountSettings, error)
- func (s *Scraper) GetBookmarks(ctx context.Context, maxTweetsNbr int) <-chan *ScrappedTweetResult
- func (s *Scraper) GetCookies() []*http.Cookie
- func (s *Scraper) GetForYouTweets(ctx context.Context, maxTweetsNbr int) <-chan *ScrappedTweetResult
- func (s *Scraper) GetGuestToken() error
- func (s *Scraper) GetHomeTweets(ctx context.Context, maxTweetsNbr int) <-chan *ScrappedTweetResult
- func (s *Scraper) GetMediaTweets(ctx context.Context, user string, maxTweetsNbr int) <-chan *ScrappedTweetResult
- 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 *ScrappedTweetResult
- func (s *Scraper) GetTweetsAndReplies(ctx context.Context, user string, maxTweetsNbr int) <-chan *ScrappedTweetResult
- func (s *Scraper) GetUserAgent() string
- 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 *ScrappedTweetResult
- 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) SetUserAgent(userAgent string)
- 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 ScrappedTweetResult
- type SearchMode
- type SearchTimeline
- type Space
- type SpaceParticipants
- type SpaceUser
- type ThreadCursor
- type ThreadedConversation
- type Topic
- type Tweet
- type TweetResult
- type TweetSchedule
- type UnifiedCard
- type Url
- type UserV2
- type Video
Constants ¶
const ( MentionJSONID = "id" MentionJSONUsername = "username" MentionJSONName = "name" UrlJSONDisplayURL = "display_url" UrlJSONExpandedURL = "expanded_url" UrlJSONURL = "url" UrlJSONIndices = "indices" PhotoJSONID = "id" PhotoJSONURL = "url" VideoJSONID = "id" VideoJSONPreview = "preview" VideoJSONURL = "url" VideoJSONHLSURL = "hls_url" GIFJSONID = "id" GIFJSONPreview = "preview" GIFJSONURL = "url" TweetJSONVersion = "version" TweetJSONConversationID = "conversation_id" TweetJSONGIFs = "gifs" TweetJSONHTML = "html" TweetJSONID = "id" TweetJSONInReplyToStatus = "in_reply_to_status" TweetJSONInReplyToStatusID = "in_reply_to_status_id" TweetJSONIsQuoted = "is_quoted" TweetJSONIsPin = "is_pin" TweetJSONIsReply = "is_reply" TweetJSONIsRetweet = "is_retweet" TweetJSONIsSelfThread = "is_self_thread" TweetJSONLikes = "likes" TweetJSONName = "name" TweetJSONMentions = "mentions" TweetJSONPermanentURL = "permanent_url" TweetJSONPhotos = "photos" TweetJSONPlace = "place" TweetJSONQuotedStatus = "quoted_status" TweetJSONQuotedStatusID = "quoted_status_id" TweetJSONReplies = "replies" TweetJSONRetweets = "retweets" TweetJSONRetweetedStatus = "retweeted_status" TweetJSONRetweetedStatusID = "retweeted_status_id" TweetJSONText = "text" TweetJSONThread = "thread" TweetJSONTimeParsed = "time_parsed" TweetJSONTimestamp = "timestamp" TweetJSONURLs = "urls" TweetJSONUserID = "user_id" TweetJSONUsername = "username" TweetJSONAvatar = "avatar" TweetJSONVideos = "videos" TweetJSONViews = "views" TweetJSONSensitiveContent = "sensitive_content" ProfileResultJSONError = "error" ScrappedTweetResultJSONError = "error" ScheduledTweetJSONID = "id" ScheduledTweetJSONState = "state" ScheduledTweetJSONExecuteAt = "execute_at" ScheduledTweetJSONText = "text" ScheduledTweetJSONVideos = "videos" ScheduledTweetJSONPhotos = "photos" ScheduledTweetJSONGIFs = "gifs" ExtendedMediaJSONIDStr = "id_str" ExtendedMediaJSONMediaURLHttps = "media_url_https" ExtendedMediaJSONExtSensitiveMediaWarning = "ext_sensitive_media_warning" ExtendedMediaJSONType = "type" ExtendedMediaJSONURL = "url" ExtendedMediaJSONVideoInfo = "video_info" ProfessionalJSONRestID = "rest_id" ProfessionalJSONProfessionalType = "professional_type" ProfessionalJSONCategory = "category" UserV2JSONID = "id" UserV2JSONRestID = "rest_id" UserV2JSONAffiliatesHighlightLabel = "affiliates_highlighted_label" UserV2JSONAvatar = "avatar" UserV2JSONCore = "core" UserV2JSONDmPermissions = "dm_permissions" UserV2JSONFollowedBy = "followed_by" UserV2JSONFollowing = "following" UserV2JSONHasGraduatedAccess = "has_graduated_access" UserV2JSONIsBlueVerified = "is_blue_verified" UserV2JSONLegacy = "legacy" UserV2JSONLocation = "location" UserV2JSONMediaPermissions = "media_permissions" UserV2JSONParodyCommentaryFanLabel = "parody_commentary_fan_label" UserV2JSONProfileImageShape = "profile_image_shape" UserV2JSONProfessional = "professional" UserV2JSONProfileBio = "profile_bio" UserV2JSONPrivacy = "privacy" UserV2JSONRelationshipPerspectives = "relationship_perspectives" UserV2JSONTipjarSettings = "tipjar_settings" UserV2JSONSuperFollowEligible = "super_follow_eligible" UserV2JSONVerification = "verification" PlaceJSONID = "id" PlaceJSONPlaceType = "place_type" PlaceJSONName = "name" PlaceJSONFullName = "full_name" PlaceJSONCountryCode = "country_code" PlaceJSONCountry = "country" PlaceJSONBoundingBox = "bounding_box" )
const DefaultClientTimeout = 10 * time.Second
default http client timeout
const DefaultUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
UserID string `json:"user_id"`
Name string `json:"name"`
ScreenName string `json:"screen_name"`
AvatarImageURL string `json:"avatar_image_url"`
IsSuspended bool `json:"is_suspended"`
IsVerified bool `json:"is_verified"`
IsProtected bool `json:"is_protected"`
IsAuthValid bool `json:"is_auth_valid"`
}
type AccountList ¶
type AccountList struct {
Users []Account `json:"users"`
}
type AccountSettings ¶
type AccountSettings struct {
ScreenName string `json:"screen_name"`
Protected bool `json:"protected"`
DisplaySensitiveMedia bool `json:"display_sensitive_media"`
Language string `json:"language"`
CountryCode string `json:"country_code"`
DiscoverableByEmail bool `json:"discoverable_by_email"`
DiscoverableByMobilePhone bool `json:"discoverable_by_mobile_phone"`
PersonalizedTrends bool `json:"personalized_trends"`
AllowMediaTagging string `json:"allow_media_tagging"`
AllowContributorRequest string `json:"allow_contributor_request"`
AllowAdsPersonalization bool `json:"allow_ads_personalization"`
AllowLoggedOutDevicePersonalization bool `json:"allow_logged_out_device_personalization"`
AllowLocationHistoryPersonalization bool `json:"allow_location_history_personalization"`
AllowSharingDataForThirdPartyPersonalization bool `json:"allow_sharing_data_for_third_party_personalization"`
AllowDmsFrom string `json:"allow_dms_from"`
AllowDmGroupsFrom string `json:"allow_dm_groups_from"`
AddressBookLiveSyncEnabled bool `json:"address_book_live_sync_enabled"`
UniversalQualityFilteringEnabled string `json:"universal_quality_filtering_enabled"`
DmReceiptSetting string `json:"dm_receipt_setting"`
AllowAuthenticatedPeriscopeRequests bool `json:"allow_authenticated_periscope_requests"`
ProtectPasswordReset bool `json:"protect_password_reset"`
RequirePasswordLogin bool `json:"require_password_login"`
RequiresLoginVerification bool `json:"requires_login_verification"`
DmQualityFilter string `json:"dm_quality_filter"`
AutoplayDisabled bool `json:"autoplay_disabled"`
}
type ExtendedMedia ¶
type ExtendedMedia struct {
IDStr string `bson:"id_str,omitempty" json:"id_str,omitempty"`
MediaURLHttps string `bson:"media_url_https,omitempty" json:"media_url_https,omitempty"`
ExtSensitiveMediaWarning struct {
AdultContent bool `bson:"adult_content,omitempty" json:"adult_content,omitempty"`
GraphicViolence bool `bson:"graphic_violence,omitempty" json:"graphic_violence,omitempty"`
Other bool `bson:"other,omitempty" json:"other,omitempty"`
} `bson:"ext_sensitive_media_warning,omitempty" json:"ext_sensitive_media_warning,omitempty"`
Type string `bson:"type,omitempty" json:"type,omitempty"`
URL string `bson:"url,omitempty" json:"url,omitempty"`
VideoInfo struct {
Variants []struct {
Type string `bson:"content_type,omitempty" json:"content_type,omitempty"`
Bitrate int `bson:"bitrate,omitempty" json:"bitrate,omitempty"`
URL string `bson:"url,omitempty" json:"url,omitempty"`
} `bson:"variants,omitempty" json:"variants,omitempty"`
} `bson:"video_info,omitempty" json:"video_info,omitempty"`
}
type GIF ¶
type GIF struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
Preview string `bson:"preview,omitempty" json:"preview,omitempty"`
URL string `bson:"url,omitempty" json:"url,omitempty"`
}
GIF type.
type Mention ¶
type Mention struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
Username string `bson:"username,omitempty" json:"username,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
}
Mention type.
type OpenAccount ¶
type Photo ¶
type Photo struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
URL string `bson:"url,omitempty" json:"url,omitempty"`
}
Photo type.
type Place ¶
type Place struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
PlaceType string `bson:"place_type,omitempty" json:"place_type,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
FullName string `bson:"full_name,omitempty" json:"full_name,omitempty"`
CountryCode string `bson:"country_code,omitempty" json:"country_code,omitempty"`
Country string `bson:"country,omitempty" json:"country,omitempty"`
BoundingBox struct {
Type string `bson:"type,omitempty" json:"type,omitempty"`
Coordinates [][][]float64 `bson:"coordinates,omitempty" json:"coordinates,omitempty"`
} `bson:"bounding_box,omitempty" json:"bounding_box,omitempty"`
}
type ProcessingInfo ¶
type Professional ¶ added in v0.0.4
type Professional struct {
RestID string `bson:"rest_id,omitempty" json:"rest_id,omitempty"`
ProfessionalType string `bson:"professional_type,omitempty" json:"professional_type,omitempty"`
// interface{} 대신 구체적인 구조체 슬라이스로 변경
Category []struct {
ID int `bson:"id,omitempty" json:"id,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
IconName string `bson:"icon_name,omitempty" json:"icon_name,omitempty"`
} `bson:"category,omitempty" json:"category,omitempty"`
}
type Profile ¶
type Profile struct {
Avatar string
Banner string
Biography string
Birthday string
FollowersCount int
FollowingCount int
FriendsCount int
IsPrivate bool
IsVerified bool
IsBlueVerified 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
MediaCount int
FastFollowersCount int
NormalFollowersCount int
ProfileImageShape string
HasGraduatedAccess bool
CanHighlightTweets bool
}
Profile of twitter user.
type ProfileResult ¶
type ProfileResult struct {
Profile `bson:",inline,omitempty" json:",inline,omitempty"`
Error error `bson:"error,omitempty" json:"error,omitempty"`
}
ProfileResult of scrapping.
type ScheduledTweet ¶
type ScheduledTweet struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
State string `bson:"state,omitempty" json:"state,omitempty"`
ExecuteAt time.Time `bson:"execute_at,omitempty" json:"execute_at,omitempty"`
Text string `bson:"text,omitempty" json:"text,omitempty"`
Videos []Video `bson:"videos,omitempty" json:"videos,omitempty"`
Photos []Photo `bson:"photos,omitempty" json:"photos,omitempty"`
GIFs []GIF `bson:"gifs,omitempty" json:"gifs,omitempty"`
}
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) FetchTweetsAndReplies ¶
func (s *Scraper) FetchTweetsAndReplies(user string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
FetchTweetsAndReplies gets tweets and replies for a given user, via the Twitter frontend API.
func (*Scraper) FetchTweetsAndRepliesByUserID ¶
func (s *Scraper) FetchTweetsAndRepliesByUserID(userID string, maxReplysNbr int, cursor string) ([]*Tweet, string, error)
FetchTweetsAndRepliesByUserID gets tweets and replies for a given userID, via the Twitter frontend GraphQL 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) GetAccountList ¶
func (*Scraper) GetAccountSettings ¶
func (s *Scraper) GetAccountSettings() (AccountSettings, error)
func (*Scraper) GetBookmarks ¶
func (s *Scraper) GetBookmarks(ctx context.Context, maxTweetsNbr int) <-chan *ScrappedTweetResult
GetBookmarks returns channel with tweets from user bookmarks.
func (*Scraper) GetCookies ¶
func (*Scraper) GetForYouTweets ¶
func (s *Scraper) GetForYouTweets(ctx context.Context, maxTweetsNbr int) <-chan *ScrappedTweetResult
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 *ScrappedTweetResult
GetHomeTweets returns channel with tweets from home timeline
func (*Scraper) GetMediaTweets ¶
func (s *Scraper) GetMediaTweets(ctx context.Context, user string, maxTweetsNbr int) <-chan *ScrappedTweetResult
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) GetTweets ¶
func (s *Scraper) GetTweets(ctx context.Context, user string, maxTweetsNbr int) <-chan *ScrappedTweetResult
GetTweets returns channel with tweets for a given user.
func (*Scraper) GetTweetsAndReplies ¶
func (s *Scraper) GetTweetsAndReplies(ctx context.Context, user string, maxTweetsNbr int) <-chan *ScrappedTweetResult
GetTweetsAndReplies returns channel with tweets and replies for a given user.
func (*Scraper) GetUserAgent ¶
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 *ScrappedTweetResult
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) SetUserAgent ¶
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 ScrappedTweetResult ¶ added in v0.0.4
type ScrappedTweetResult struct {
Tweet `bson:",inline,omitempty" json:",inline,omitempty"`
Error error `bson:"error,omitempty" json:"error,omitempty"`
}
ScrappedTweetResult of scrapping.
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 SearchTimeline ¶
type SearchTimeline struct {
Data struct {
SearchByRawQuery struct {
SearchTimeline struct {
Timeline struct {
Instructions []struct {
Type string `json:"type"`
Entries []entry `json:"entries"`
Entry entry `json:"entry,omitempty"`
} `json:"instructions"`
} `json:"timeline"`
} `json:"search_timeline"`
} `json:"search_by_raw_query"`
} `json:"data"`
}
func (*SearchTimeline) ParseTweets ¶
func (timeline *SearchTimeline) ParseTweets() ([]*Tweet, string)
type SpaceParticipants ¶
type ThreadCursor ¶
type ThreadedConversation ¶ added in v0.0.2
type ThreadedConversation struct {
Data struct {
ThreadedConversationWithInjectionsV2 struct {
Instructions []struct {
Type string `json:"type"`
Entry entry `json:"entry"`
Entries []entry `json:"entries"`
ModuleItems []item `json:"moduleItems"`
} `json:"instructions"`
} `json:"threaded_conversation_with_injections_v2"`
} `json:"data"`
}
func (*ThreadedConversation) Parse ¶ added in v0.0.2
func (conversation *ThreadedConversation) Parse(focalTweetID string) ([]*Tweet, []*ThreadCursor)
type Tweet ¶
type Tweet struct {
Version int `bson:"version,omitempty" json:"version,omitempty"`
ConversationID string `bson:"conversation_id,omitempty" json:"conversation_id,omitempty"`
GIFs []GIF `bson:"gifs,omitempty" json:"gifs,omitempty"`
HTML string `bson:"html,omitempty" json:"html,omitempty"`
// ID는 핵심 식별자이므로 omitempty 제거
ID string `bson:"id" json:"id"`
InReplyToStatus *Tweet `bson:"in_reply_to_status,omitempty" json:"in_reply_to_status,omitempty"`
InReplyToStatusID string `bson:"in_reply_to_status_id,omitempty" json:"in_reply_to_status_id,omitempty"`
IsQuoted bool `bson:"is_quoted,omitempty" json:"is_quoted,omitempty"`
IsPin bool `bson:"is_pin,omitempty" json:"is_pin,omitempty"`
IsReply bool `bson:"is_reply,omitempty" json:"is_reply,omitempty"`
IsRetweet bool `bson:"is_retweet,omitempty" json:"is_retweet,omitempty"`
IsSelfThread bool `bson:"is_self_thread,omitempty" json:"is_self_thread,omitempty"`
Likes int `bson:"likes,omitempty" json:"likes,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
Mentions []Mention `bson:"mentions,omitempty" json:"mentions,omitempty"`
PermanentURL string `bson:"permanent_url,omitempty" json:"permanent_url,omitempty"`
Photos []Photo `bson:"photos,omitempty" json:"photos,omitempty"`
Place *Place `bson:"place,omitempty" json:"place,omitempty"`
QuotedStatus *Tweet `bson:"quoted_status,omitempty" json:"quoted_status,omitempty"`
QuotedStatusID string `bson:"quoted_status_id,omitempty" json:"quoted_status_id,omitempty"`
Replies int `bson:"replies,omitempty" json:"replies,omitempty"`
Retweets int `bson:"retweets,omitempty" json:"retweets,omitempty"`
RetweetedStatus *Tweet `bson:"retweeted_status,omitempty" json:"retweeted_status,omitempty"`
RetweetedStatusID string `bson:"retweeted_status_id,omitempty" json:"retweeted_status_id,omitempty"`
Text string `bson:"text,omitempty" json:"text,omitempty"`
Thread []*Tweet `bson:"thread,omitempty" json:"thread,omitempty"`
TimeParsed time.Time `bson:"time_parsed,omitempty" json:"time_parsed,omitempty"`
Timestamp int64 `bson:"timestamp,omitempty" json:"timestamp,omitempty"`
URLs []string `bson:"urls,omitempty" json:"urls,omitempty"`
UserID string `bson:"user_id,omitempty" json:"user_id,omitempty"`
Username string `bson:"username,omitempty" json:"username,omitempty"`
Avatar string `bson:"avatar,omitempty" json:"avatar,omitempty"`
Videos []Video `bson:"videos,omitempty" json:"videos,omitempty"`
Views int `bson:"views,omitempty" json:"views,omitempty"`
SensitiveContent bool `bson:"sensitive_content,omitempty" json:"sensitive_content,omitempty"`
}
Tweet type.
type TweetResult ¶
type TweetResult struct {
Data struct {
TweetResult struct {
Result result `json:"result"`
} `json:"tweetResult"`
} `json:"data"`
}
func (*TweetResult) Parse ¶ added in v0.0.4
func (tweetResult *TweetResult) Parse() *Tweet
parseLegacyTweet 이 함수가 메인임
type UnifiedCard ¶
type UnifiedCard struct {
Type string `json:"type"`
Components []string `json:"components"`
MediaEntities map[string]struct {
ID int64 `json:"id"`
IDStr string `json:"id_str"`
MediaURLHTTPS string `json:"media_url_https"`
Type string `json:"type"`
OriginalInfo struct {
Width int `json:"width"`
Height int `json:"height"`
} `json:"original_info"`
SourceUserID int64 `json:"source_user_id"`
VideoInfo struct {
AspectRatio []int `json:"aspect_ratio"`
DurationMillis int `json:"duration_millis"`
Variants []struct {
Bitrate int `json:"bitrate,omitempty"`
ContentType string `json:"content_type"`
URL string `json:"url"`
} `json:"variants"`
} `json:"video_info"`
} `json:"media_entities"`
}
type Url ¶
type Url struct {
DisplayURL string `bson:"display_url,omitempty" json:"display_url,omitempty"`
ExpandedURL string `bson:"expanded_url,omitempty" json:"expanded_url,omitempty"`
URL string `bson:"url,omitempty" json:"url,omitempty"`
Indices []int `bson:"indices,omitempty" json:"indices,omitempty"`
}
Url represents a URL with display, expanded, and index data.
type UserV2 ¶ added in v0.0.3
type UserV2 struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
RestID string `bson:"rest_id,omitempty" json:"rest_id,omitempty"`
AffiliatesHighlightLabel struct {
Label struct {
URL struct {
URL string `bson:"url,omitempty" json:"url,omitempty"`
URLType string `bson:"urlType,omitempty" json:"urlType,omitempty"`
} `bson:"url,omitempty" json:"url,omitempty"`
Badge struct {
URL string `bson:"url,omitempty" json:"url,omitempty"`
} `bson:"badge,omitempty" json:"badge,omitempty"`
Description string `bson:"description,omitempty" json:"description,omitempty"`
UserLabelType string `bson:"userLabelType,omitempty" json:"userLabelType,omitempty"`
UserLabelDisplayType string `bson:"userLabelDisplayType,omitempty" json:"userLabelDisplayType,omitempty"`
} `bson:"label,omitempty" json:"label,omitempty"`
} `bson:"affiliates_highlighted_label,omitempty" json:"affiliates_highlighted_label,omitempty"`
Avatar struct {
ImageURL string `bson:"image_url,omitempty" json:"image_url,omitempty"`
} `bson:"avatar,omitempty" json:"avatar,omitempty"`
Core struct {
CreatedAt string `bson:"created_at,omitempty" json:"created_at,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
ScreenName string `bson:"screen_name,omitempty" json:"screen_name,omitempty"`
} `bson:"core,omitempty" json:"core,omitempty"`
DmPermissions struct {
CanDM bool `bson:"can_dm,omitempty" json:"can_dm,omitempty"`
} `bson:"dm_permissions,omitempty" json:"dm_permissions,omitempty"`
FollowedBy bool `bson:"followed_by,omitempty" json:"followed_by,omitempty"`
Following bool `bson:"following,omitempty" json:"following,omitempty"`
HasGraduatedAccess bool `bson:"has_graduated_access,omitempty" json:"has_graduated_access,omitempty"`
IsBlueVerified bool `bson:"is_blue_verified,omitempty" json:"is_blue_verified,omitempty"`
Legacy legacyUserV2 `bson:"legacy,omitempty" json:"legacy,omitempty"`
Location struct {
Location string `bson:"location,omitempty" json:"location,omitempty"`
} `bson:"location,omitempty" json:"location,omitempty"`
MediaPermissions struct {
CanMediaTag bool `bson:"can_media_tag,omitempty" json:"can_media_tag,omitempty"`
} `bson:"media_permissions,omitempty" json:"media_permissions,omitempty"`
ParodyCommentaryFanLabel string `bson:"parody_commentary_fan_label,omitempty" json:"parody_commentary_fan_label,omitempty"`
ProfileImageShape string `bson:"profile_image_shape,omitempty" json:"profile_image_shape,omitempty"`
Professional Professional `bson:"professional,omitempty" json:"professional,omitempty"`
ProfileBio struct {
Description string `bson:"description,omitempty" json:"description,omitempty"`
} `bson:"profile_bio,omitempty" json:"profile_bio,omitempty"`
Privacy struct {
Protected bool `bson:"protected,omitempty" json:"protected,omitempty"`
} `bson:"privacy,omitempty" json:"privacy,omitempty"`
RelationshipPerspectives struct {
Following bool `bson:"following,omitempty" json:"following,omitempty"`
} `bson:"relationship_perspectives,omitempty" json:"relationship_perspectives,omitempty"`
TipjarSettings struct {
IsEnabled bool `bson:"is_enabled,omitempty" json:"is_enabled,omitempty"`
} `bson:"tipjar_settings,omitempty" json:"tipjar_settings,omitempty"`
SuperFollowEligible bool `bson:"super_follow_eligible,omitempty" json:"super_follow_eligible,omitempty"`
Verification struct {
Verified bool `bson:"verified,omitempty" json:"verified,omitempty"`
} `bson:"verification,omitempty" json:"verification,omitempty"`
}
UserV2 represents a Twitter user profile.