Multiple images in HTML
This commit is contained in:
parent
7c236e105c
commit
dcb8906748
1 changed files with 3 additions and 4 deletions
|
|
@ -38,6 +38,7 @@ type timeline struct {
|
||||||
Other bool `json:"other"`
|
Other bool `json:"other"`
|
||||||
} `json:"ext_sensitive_media_warning"`
|
} `json:"ext_sensitive_media_warning"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
URL string `json:"url"`
|
||||||
VideoInfo struct {
|
VideoInfo struct {
|
||||||
Variants []struct {
|
Variants []struct {
|
||||||
Bitrate int `json:"bitrate,omitempty"`
|
Bitrate int `json:"bitrate,omitempty"`
|
||||||
|
|
@ -202,9 +203,7 @@ func (timeline *timeline) parseTweet(id string) *Tweet {
|
||||||
for _, media := range tweet.ExtendedEntities.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)
|
||||||
}
|
} else if media.Type == "video" {
|
||||||
|
|
||||||
if media.Type == "video" {
|
|
||||||
video := Video{
|
video := Video{
|
||||||
ID: media.IDStr,
|
ID: media.IDStr,
|
||||||
Preview: media.MediaURLHttps,
|
Preview: media.MediaURLHttps,
|
||||||
|
|
@ -251,7 +250,7 @@ func (timeline *timeline) parseTweet(id string) *Tweet {
|
||||||
return fmt.Sprintf(`<a href="%s">%s</a>`, entity.ExpandedURL, tco)
|
return fmt.Sprintf(`<a href="%s">%s</a>`, entity.ExpandedURL, tco)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, entity := range tweet.Entities.Media {
|
for _, entity := range tweet.ExtendedEntities.Media {
|
||||||
if tco == entity.URL {
|
if tco == entity.URL {
|
||||||
return fmt.Sprintf(`<br><a href="%s"><img src="%s"/></a>`, tco, entity.MediaURLHttps)
|
return fmt.Sprintf(`<br><a href="%s"><img src="%s"/></a>`, tco, entity.MediaURLHttps)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue