From 66168ecafa9a4aabf0844edf80eb93c3a2dcda37 Mon Sep 17 00:00:00 2001 From: wukko Date: Wed, 5 Oct 2022 09:15:12 +0600 Subject: [PATCH] i was accidentally testing prod and not the local version oh my fucking god --- src/modules/services/twitter.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/modules/services/twitter.js b/src/modules/services/twitter.js index 166c0ef..f2fa170 100644 --- a/src/modules/services/twitter.js +++ b/src/modules/services/twitter.js @@ -11,13 +11,9 @@ export default async function(obj) { return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'twitter') } }) let parsbod = JSON.parse(req_status.body); - if (parsbod["extended_entities"] && parsbod["extended_entities"]["media"]) { - let media = parsbod["extended_entities"]["media"][0] - if (media["type"] === "video" || media["type"] === "animated_gif") { - return { urls: media["video_info"]["variants"].filter((v) => { if (v["content_type"] == "video/mp4") return true; }).sort((a, b) => Number(b.bitrate) - Number(a.bitrate))[0]["url"].split('?')[0], audioFilename: `twitter_${obj.id}_audio` } - } else { - return { error: loc(obj.lang, 'ErrorNoVideosInTweet') } - } + if (parsbod["video"] && parsbod["video"]["variants"]) { + let media = parsbod["video"]["variants"]; + return { urls: media.filter((v) => { if (v["type"] == "video/mp4") return true; }).sort((a, b) => Number(b["src"].split("vid/")[1].split("x")[0]) - Number(a["src"].split("vid/")[1].split("x")[0]))[0]["src"].split('?')[0], audioFilename: `twitter_${obj.id}_audio` } } else { return { error: loc(obj.lang, 'ErrorNoVideosInTweet') } }