Fix new video format and new user suspended format
This commit is contained in:
parent
5d6c40246c
commit
9b85d81b89
@ -289,14 +289,12 @@ func (u UserResponse) ConvertToAPIUser() APIUser {
|
||||
}
|
||||
|
||||
// Banned users, new version
|
||||
if u.Data.User.Result.UnavailableMessage.Text != "" {
|
||||
if u.Data.User.Result.Reason == "Suspended" {
|
||||
ret.IsBanned = true
|
||||
}
|
||||
if u.Data.User.Result.Reason == "Suspended" {
|
||||
ret.IsBanned = true
|
||||
}
|
||||
|
||||
// Deleted users
|
||||
if ret.ID == 0 && ret.ScreenName == "" && u.Data.User.Result.UnavailableMessage.Text == "" {
|
||||
if ret.ID == 0 && ret.ScreenName == "" && u.Data.User.Result.Reason != "Suspended" {
|
||||
ret.DoesntExist = true
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
{"data":{"user":{"result":{"__typename":"UserUnavailable","unavailable_message":{"rtl":false,"text":"Twitter suspends accounts that violate the Twitter Rules. Learn more","entities":[{"fromIndex":58,"toIndex":68,"ref":{"type":"TimelineUrl","url":"https://help.twitter.com/rules-and-policies/twitter-rules","urlType":"ExternalUrl"}}]},"reason":"Suspended"}}}}
|
||||
{"data":{"user":{"result":{"__typename":"UserUnavailable","message":"User is suspended","reason":"Suspended"}}}}
|
||||
|
@ -169,8 +169,10 @@ func ParseSingleTweet(apiTweet APITweet) (ret Tweet, err error) {
|
||||
|
||||
// Process images
|
||||
for _, media := range apiTweet.Entities.Media {
|
||||
if media.Type != "photo" { // TODO: remove this eventually
|
||||
panic(fmt.Errorf("Unknown media type %q:\n %w", media.Type, EXTERNAL_API_ERROR))
|
||||
if media.Type != "photo" {
|
||||
// Videos now have an entry in "Entities.Media" but they can be ignored; the useful bit is in ExtendedEntities
|
||||
// So skip ones that aren't "photo"
|
||||
continue
|
||||
}
|
||||
new_image := ParseAPIMedia(media)
|
||||
new_image.TweetID = ret.ID
|
||||
|
Loading…
x
Reference in New Issue
Block a user