fix: extract Twitter video thumbnails from correct API field

Twitter video thumbnails are provided by the FxTwitter API directly
in the video object's thumbnail_url field, not in a separate photos
array. This fixes thumbnail generation for Twitter video links.
This commit is contained in:
soup 2026-01-18 00:41:02 -05:00
parent 4a2cb341fa
commit 4763e69b79
Signed by: soup
SSH key fingerprint: SHA256:GYxje8eQkJ6HZKzVWDdyOUF1TyDiprruGhE0Ym8qYDY

View file

@ -128,7 +128,8 @@ type fxTwitterResponse struct {
Height int `json:"height"`
} `json:"photos"`
Videos []struct {
URL string `json:"url"`
URL string `json:"url"`
ThumbnailURL string `json:"thumbnail_url"`
} `json:"videos"`
} `json:"media"`
IsNoteTweet bool `json:"is_note_tweet"`
@ -204,11 +205,8 @@ func parseFxTwitterResponse(fxResp *fxTwitterResponse, tweetID string, originalU
if len(tweet.Media.Videos) > 0 {
videoURL = tweet.Media.Videos[0].URL
thumbnailURL = tweet.Media.Videos[0].ThumbnailURL
mediaType = "video"
// Videos usually have a poster/thumbnail in photos
if len(tweet.Media.Photos) > 0 {
thumbnailURL = tweet.Media.Photos[0].URL
}
} else if len(tweet.Media.Photos) > 0 {
thumbnailURL = tweet.Media.Photos[0].URL
for _, photo := range tweet.Media.Photos {