i was accidentally testing prod and not the local version oh my fucking god

This commit is contained in:
wukko 2022-10-05 09:15:12 +06:00
parent 3029d04cc5
commit 66168ecafa

View file

@ -11,13 +11,9 @@ export default async function(obj) {
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'twitter') } return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'twitter') }
}) })
let parsbod = JSON.parse(req_status.body); let parsbod = JSON.parse(req_status.body);
if (parsbod["extended_entities"] && parsbod["extended_entities"]["media"]) { if (parsbod["video"] && parsbod["video"]["variants"]) {
let media = parsbod["extended_entities"]["media"][0] let media = parsbod["video"]["variants"];
if (media["type"] === "video" || media["type"] === "animated_gif") { 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` }
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') }
}
} else { } else {
return { error: loc(obj.lang, 'ErrorNoVideosInTweet') } return { error: loc(obj.lang, 'ErrorNoVideosInTweet') }
} }