twitter: handle no media properly

This commit is contained in:
wukko 2024-03-07 00:27:17 +06:00
parent f34f6d131c
commit 2cb99880d6

View file

@ -104,7 +104,7 @@ export default async function({ id, index, toGif }) {
const baseTweet = tweet.data.tweetResult.result.legacy, const baseTweet = tweet.data.tweetResult.result.legacy,
repostedTweet = baseTweet.retweeted_status_result?.result.legacy.extended_entities; repostedTweet = baseTweet.retweeted_status_result?.result.legacy.extended_entities;
let media = (repostedTweet?.media || baseTweet.extended_entities.media); let media = (repostedTweet?.media || baseTweet?.extended_entities?.media);
media = media?.filter(m => m.video_info?.variants?.length); media = media?.filter(m => m.video_info?.variants?.length);
// check if there's a video at given index (/video/<index>) // check if there's a video at given index (/video/<index>)