Merge pull request #54 from VTGare/master
include every photo from multi-photo tweets
This commit is contained in:
commit
41d7f514e3
1 changed files with 5 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 {
|
||||||
|
|
@ -217,6 +218,7 @@ func (timeline *timeline) parseTweet(id string) *Tweet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tw.Photos = append(tw.Photos, video.Preview)
|
||||||
tw.Videos = append(tw.Videos, video)
|
tw.Videos = append(tw.Videos, video)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue