From 37e44f92eaae719853476e86085635f83bbfb66d Mon Sep 17 00:00:00 2001 From: wukko Date: Tue, 25 Oct 2022 23:54:52 +0600 Subject: [PATCH] oh my god --- src/modules/services/tiktok.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/services/tiktok.js b/src/modules/services/tiktok.js index d5b652d6..6493b16a 100644 --- a/src/modules/services/tiktok.js +++ b/src/modules/services/tiktok.js @@ -40,6 +40,7 @@ export default async function(obj) { try { detail = await got.get(config[obj.host]["api"].replace("{postId}", obj.postId), { headers: {"User-Agent":"TikTok 26.2.0 rv:262018 (iPhone; iOS 14.4.2; en_US) Cronet"} }); detail = selector(JSON.parse(detail.body), obj.host, obj.postId); + if (!detail) throw new Error() } catch (e) { if (obj.host === "tiktok") { let html = await got.get(`https://tiktok.com/@video/video/${obj.postId}`, { headers: { "user-agent": userAgent } }); @@ -52,7 +53,6 @@ export default async function(obj) { } else throw new Error() } else throw new Error() } - if (!detail) return { error: loc(obj.lang, 'ErrorEmptyDownload') }; let video, videoFilename, audioFilename, isMp3, audio, images = detail["image_post_info"] ? detail["image_post_info"]["images"] : false, filenameBase = `${obj.host}_${obj.postId}`;