feat: add IsBlueVerified to profile responses
Add support for Twitter's blue verification status in profile responses: - Add IsBlueVerified field to user struct in GetProfile response - Update parseProfile and parseProfileV2 to include blue verification status - Add ProfileImageShape and HasGraduatedAccess fields to profile responses This change ensures the API correctly returns blue verification status for both direct profile queries and timeline responses.
This commit is contained in:
parent
7226460e05
commit
388445d4c2
2 changed files with 32 additions and 24 deletions
15
profile.go
15
profile.go
|
|
@ -50,9 +50,10 @@ type user struct {
|
|||
Data struct {
|
||||
User struct {
|
||||
Result struct {
|
||||
RestID string `json:"rest_id"`
|
||||
Legacy legacyUser `json:"legacy"`
|
||||
Message string `json:"message"`
|
||||
RestID string `json:"rest_id"`
|
||||
Legacy legacyUser `json:"legacy"`
|
||||
Message string `json:"message"`
|
||||
IsBlueVerified bool `json:"is_blue_verified"`
|
||||
} `json:"result"`
|
||||
} `json:"user"`
|
||||
} `json:"data"`
|
||||
|
|
@ -118,7 +119,9 @@ func (s *Scraper) GetProfile(username string) (Profile, error) {
|
|||
return Profile{}, fmt.Errorf("either @%s does not exist or is private", username)
|
||||
}
|
||||
|
||||
return parseProfile(jsn.Data.User.Result.Legacy), nil
|
||||
profile := parseProfile(jsn.Data.User.Result.Legacy)
|
||||
profile.IsBlueVerified = jsn.Data.User.Result.IsBlueVerified
|
||||
return profile, nil
|
||||
}
|
||||
|
||||
func (s *Scraper) GetProfileByID(userID string) (Profile, error) {
|
||||
|
|
@ -175,7 +178,9 @@ func (s *Scraper) GetProfileByID(userID string) (Profile, error) {
|
|||
return Profile{}, fmt.Errorf("either @%s does not exist or is private", userID)
|
||||
}
|
||||
|
||||
return parseProfile(jsn.Data.User.Result.Legacy), nil
|
||||
profile := parseProfile(jsn.Data.User.Result.Legacy)
|
||||
profile.IsBlueVerified = jsn.Data.User.Result.IsBlueVerified
|
||||
return profile, nil
|
||||
}
|
||||
|
||||
// GetUserIDByScreenName from API
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue