-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount.go
67 lines (59 loc) · 3.03 KB
/
account.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
package twitterscraper
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 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 struct {
Users []Account `json:"users"`
}
func (s *Scraper) GetAccountSettings() (AccountSettings, error) {
var settings AccountSettings
req, err := s.newRequest("GET", "https://api.twitter.com/1.1/account/settings.json")
if err != nil {
return settings, err
}
err = s.RequestAPI(req, &settings)
return settings, err
}
func (s *Scraper) GetAccountList() ([]Account, error) {
var list AccountList
req, err := s.newRequest("GET", "https://api.twitter.com/1.1/account/multi/list.json")
if err != nil {
return list.Users, err
}
err = s.RequestAPI(req, &list)
return list.Users, err
}