Skip to content

Commit 4473fa0

Browse files
author
Wade
committed
parse users
1 parent 1234e7f commit 4473fa0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

timeline_v3.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,23 @@ func (timeline *TimelineV3) ParseTweets() ([]*Tweet, string) {
6161
}
6262
return tweets, cursor
6363
}
64+
65+
66+
67+
func (timeline *TimelineV3) ParseUsers() ([]*Profile, string) {
68+
var cursor string
69+
var users []*Profile
70+
for _, instruction := range timeline.Data.User.Result.Timeline.Timeline.Instructions {
71+
for _, entry := range instruction.Entries {
72+
if entry.Content.CursorType == "Bottom" {
73+
cursor = entry.Content.Value
74+
continue
75+
}
76+
if entry.Content.ItemContent.UserResults.Result.Typename == "User" {
77+
user := entry.Content.ItemContent.UserResults.Result.parse()
78+
users = append(users, &user)
79+
}
80+
}
81+
}
82+
return users, cursor
83+
}

0 commit comments

Comments
 (0)