forked from imperatrona/twitter-scraper
-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
249 lines (235 loc) · 7.8 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
package twitterscraper
import "time"
type (
// Mention type.
Mention struct {
ID string
Username string
Name string
}
// Photo type.
Photo struct {
ID string
URL string
}
// Video type.
Video struct {
ID string
Preview string
URL string
HLSURL string
}
// GIF type.
GIF struct {
ID string
Preview string
URL string
}
// Tweet type.
Tweet struct {
ConversationID string
GIFs []GIF
Hashtags []string
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
}
// ProfileResult of scrapping.
ProfileResult struct {
Profile
Error error
}
// TweetResult of scrapping.
TweetResult struct {
Tweet
Error error
}
ScheduledTweet struct {
ID string
State string
ExecuteAt time.Time
Text string
Videos []Video
Photos []Photo
GIFs []GIF
}
legacyTweet struct {
ConversationIDStr string `json:"conversation_id_str"`
CreatedAt string `json:"created_at"`
FavoriteCount int `json:"favorite_count"`
FullText string `json:"full_text"`
Entities struct {
Hashtags []struct {
Text string `json:"text"`
} `json:"hashtags"`
Media []struct {
MediaURLHttps string `json:"media_url_https"`
Type string `json:"type"`
URL string `json:"url"`
} `json:"media"`
URLs []struct {
ExpandedURL string `json:"expanded_url"`
URL string `json:"url"`
} `json:"urls"`
UserMentions []struct {
IDStr string `json:"id_str"`
Name string `json:"name"`
ScreenName string `json:"screen_name"`
} `json:"user_mentions"`
} `json:"entities"`
ExtendedEntities struct {
Media []struct {
IDStr string `json:"id_str"`
MediaURLHttps string `json:"media_url_https"`
ExtSensitiveMediaWarning struct {
AdultContent bool `json:"adult_content"`
GraphicViolence bool `json:"graphic_violence"`
Other bool `json:"other"`
} `json:"ext_sensitive_media_warning"`
Type string `json:"type"`
URL string `json:"url"`
VideoInfo struct {
Variants []struct {
Type string `json:"content_type"`
Bitrate int `json:"bitrate"`
URL string `json:"url"`
} `json:"variants"`
} `json:"video_info"`
} `json:"media"`
} `json:"extended_entities"`
IDStr string `json:"id_str"`
InReplyToStatusIDStr string `json:"in_reply_to_status_id_str"`
Place Place `json:"place"`
ReplyCount int `json:"reply_count"`
RetweetCount int `json:"retweet_count"`
RetweetedStatusIDStr string `json:"retweeted_status_id_str"`
RetweetedStatusResult struct {
Result *result `json:"result"`
} `json:"retweeted_status_result"`
QuotedStatusIDStr string `json:"quoted_status_id_str"`
SelfThread struct {
IDStr string `json:"id_str"`
} `json:"self_thread"`
Time time.Time `json:"time"`
UserIDStr string `json:"user_id_str"`
Views struct {
State string `json:"state"`
Count string `json:"count"`
} `json:"ext_views"`
}
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"`
FollowedBy bool `json:"followed_by"`
Following bool `json:"following"`
}
legacyUserV2 struct {
FollowedBy bool `json:"followed_by"`
Following bool `json:"following"`
CanDm bool `json:"can_dm"`
CanMediaTag bool `json:"can_media_tag"`
CreatedAt string `json:"created_at"`
DefaultProfile bool `json:"default_profile"`
DefaultProfileImage bool `json:"default_profile_image"`
Description string `json:"description"`
Entities struct {
Description struct {
Urls []interface{} `json:"urls"`
} `json:"description"`
URL struct {
Urls []struct {
DisplayURL string `json:"display_url"`
ExpandedURL string `json:"expanded_url"`
URL string `json:"url"`
Indices []int `json:"indices"`
} `json:"urls"`
} `json:"url"`
} `json:"entities"`
FastFollowersCount int `json:"fast_followers_count"`
FavouritesCount int `json:"favourites_count"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
HasCustomTimelines bool `json:"has_custom_timelines"`
IsTranslator bool `json:"is_translator"`
ListedCount int `json:"listed_count"`
Location string `json:"location"`
MediaCount int `json:"media_count"`
Name string `json:"name"`
NormalFollowersCount int `json:"normal_followers_count"`
PinnedTweetIdsStr []string `json:"pinned_tweet_ids_str"`
PossiblySensitive bool `json:"possibly_sensitive"`
ProfileBannerURL string `json:"profile_banner_url"`
ProfileImageURLHTTPS string `json:"profile_image_url_https"`
ProfileInterstitialType string `json:"profile_interstitial_type"`
ScreenName string `json:"screen_name"`
StatusesCount int `json:"statuses_count"`
TranslatorType string `json:"translator_type"`
URL string `json:"url"`
Verified bool `json:"verified"`
WantRetweets bool `json:"want_retweets"`
WithheldInCountries []interface{} `json:"withheld_in_countries"`
}
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"`
}
fetchProfileFunc func(query string, maxProfilesNbr int, cursor string) ([]*Profile, string, error)
fetchTweetFunc func(query string, maxTweetsNbr int, cursor string) ([]*Tweet, string, error)
)