1
0
mirror of https://github.com/zedeus/nitter.git synced 2026-04-15 18:22:11 -04:00

Implement mixed-media tweet support

Fixes #697 #1101
This commit is contained in:
Zed
2026-03-13 05:47:37 +01:00
parent 4bf3df94f8
commit 35a929c415
15 changed files with 304 additions and 174 deletions

View File

@@ -44,15 +44,19 @@ proc createStatusRouter*(cfg: Config) =
desc = conv.tweet.text
var
images = conv.tweet.photos.mapIt(it.url)
images = conv.tweet.getPhotos.mapIt(it.url)
video = ""
if conv.tweet.video.isSome():
images = @[get(conv.tweet.video).thumb]
let
firstMediaKind = if conv.tweet.media.len > 0: conv.tweet.media[0].kind
else: photoMedia
if firstMediaKind == videoMedia:
images = @[conv.tweet.media[0].getThumb]
video = getVideoEmbed(cfg, conv.tweet.id)
elif conv.tweet.gif.isSome():
images = @[get(conv.tweet.gif).thumb]
video = getPicUrl(get(conv.tweet.gif).url)
elif firstMediaKind == gifMedia:
images = @[conv.tweet.media[0].getThumb]
video = getPicUrl(conv.tweet.media[0].gif.url)
elif conv.tweet.card.isSome():
let card = conv.tweet.card.get()
if card.image.len > 0: