2020-12-11 20:58:49 +02:00
|
|
|
package twitterscraper
|
|
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
|
|
type (
|
|
|
|
|
// Video type.
|
|
|
|
|
Video struct {
|
|
|
|
|
ID string
|
|
|
|
|
Preview string
|
|
|
|
|
URL string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Tweet type.
|
|
|
|
|
Tweet struct {
|
2021-07-16 12:21:41 +03:00
|
|
|
Hashtags []string
|
|
|
|
|
HTML string
|
|
|
|
|
ID string
|
|
|
|
|
InReplyToStatus *Tweet
|
|
|
|
|
IsQuoted bool
|
|
|
|
|
IsPin bool
|
|
|
|
|
IsReply bool
|
|
|
|
|
IsRetweet bool
|
|
|
|
|
Likes int
|
|
|
|
|
PermanentURL string
|
|
|
|
|
Photos []string
|
2021-09-13 17:01:30 +03:00
|
|
|
Place *Place
|
2021-07-16 12:21:41 +03:00
|
|
|
QuotedStatus *Tweet
|
|
|
|
|
Replies int
|
|
|
|
|
Retweets int
|
|
|
|
|
RetweetedStatus *Tweet
|
|
|
|
|
Text string
|
|
|
|
|
TimeParsed time.Time
|
|
|
|
|
Timestamp int64
|
|
|
|
|
URLs []string
|
|
|
|
|
UserID string
|
|
|
|
|
Username string
|
|
|
|
|
Videos []Video
|
2020-12-11 20:58:49 +02:00
|
|
|
}
|
|
|
|
|
|
2021-04-22 21:38:49 +03:00
|
|
|
// ProfileResult of scrapping.
|
|
|
|
|
ProfileResult struct {
|
|
|
|
|
Profile
|
|
|
|
|
Error error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TweetResult of scrapping.
|
|
|
|
|
TweetResult struct {
|
2020-12-11 20:58:49 +02:00
|
|
|
Tweet
|
|
|
|
|
Error error
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-22 21:38:49 +03:00
|
|
|
legacyUser struct {
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
Description string `json:"description"`
|
|
|
|
|
Entities struct {
|
|
|
|
|
URL struct {
|
|
|
|
|
Urls []struct {
|
|
|
|
|
ExpandedURL string `json:"expanded_url"`
|
|
|
|
|
} `json:"urls"`
|
|
|
|
|
} `json:"url"`
|
|
|
|
|
} `json:"entities"`
|
|
|
|
|
FavouritesCount int `json:"favourites_count"`
|
|
|
|
|
FollowersCount int `json:"followers_count"`
|
|
|
|
|
FriendsCount int `json:"friends_count"`
|
|
|
|
|
IDStr string `json:"id_str"`
|
|
|
|
|
ListedCount int `json:"listed_count"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Location string `json:"location"`
|
|
|
|
|
PinnedTweetIdsStr []string `json:"pinned_tweet_ids_str"`
|
|
|
|
|
ProfileBannerURL string `json:"profile_banner_url"`
|
|
|
|
|
ProfileImageURLHTTPS string `json:"profile_image_url_https"`
|
|
|
|
|
Protected bool `json:"protected"`
|
|
|
|
|
ScreenName string `json:"screen_name"`
|
|
|
|
|
StatusesCount int `json:"statuses_count"`
|
|
|
|
|
Verified bool `json:"verified"`
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-13 17:01:30 +03:00
|
|
|
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"`
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-22 21:38:49 +03:00
|
|
|
fetchProfileFunc func(query string, maxProfilesNbr int, cursor string) ([]*Profile, string, error)
|
|
|
|
|
fetchTweetFunc func(query string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
|
2020-12-11 20:58:49 +02:00
|
|
|
)
|