include every photo from tweet

This commit is contained in:
VTGare 2022-04-09 14:41:12 +03:00
parent 5c9abef879
commit e2f8520399

View file

@ -198,17 +198,18 @@ func (timeline *timeline) parseTweet(id string) *Tweet {
for _, hash := range tweet.Entities.Hashtags { for _, hash := range tweet.Entities.Hashtags {
tw.Hashtags = append(tw.Hashtags, hash.Text) tw.Hashtags = append(tw.Hashtags, hash.Text)
} }
for _, media := range tweet.Entities.Media {
for _, media := range tweet.ExtendedEntities.Media {
if media.Type == "photo" { if media.Type == "photo" {
tw.Photos = append(tw.Photos, media.MediaURLHttps) tw.Photos = append(tw.Photos, media.MediaURLHttps)
} }
}
for _, media := range tweet.ExtendedEntities.Media {
if media.Type == "video" { if media.Type == "video" {
video := Video{ video := Video{
ID: media.IDStr, ID: media.IDStr,
Preview: media.MediaURLHttps, Preview: media.MediaURLHttps,
} }
maxBitrate := 0 maxBitrate := 0
for _, variant := range media.VideoInfo.Variants { for _, variant := range media.VideoInfo.Variants {
if variant.Bitrate > maxBitrate { if variant.Bitrate > maxBitrate {