add HLSURL to Video
This commit is contained in:
parent
6bcb914751
commit
715658ada4
2 changed files with 5 additions and 0 deletions
2
types.go
2
types.go
|
|
@ -21,6 +21,7 @@ type (
|
|||
ID string
|
||||
Preview string
|
||||
URL string
|
||||
HLSURL string
|
||||
}
|
||||
|
||||
// GIF type.
|
||||
|
|
@ -127,6 +128,7 @@ type (
|
|||
URL string `json:"url"`
|
||||
VideoInfo struct {
|
||||
Variants []struct {
|
||||
Type string `json:"content_type"`
|
||||
Bitrate int `json:"bitrate"`
|
||||
URL string `json:"url"`
|
||||
} `json:"variants"`
|
||||
|
|
|
|||
3
util.go
3
util.go
|
|
@ -248,6 +248,9 @@ func parseLegacyTweet(user *legacyUser, tweet *legacyTweet) *Tweet {
|
|||
|
||||
maxBitrate := 0
|
||||
for _, variant := range media.VideoInfo.Variants {
|
||||
if variant.Type == "application/x-mpegURL" {
|
||||
video.HLSURL = variant.URL
|
||||
}
|
||||
if variant.Bitrate > maxBitrate {
|
||||
video.URL = strings.TrimSuffix(variant.URL, "?tag=10")
|
||||
maxBitrate = variant.Bitrate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue