include every photo from tweet
This commit is contained in:
parent
5c9abef879
commit
e2f8520399
1 changed files with 4 additions and 3 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue