From 488e3fd1be5177a98f3c14aa6f0d93476cef03bd Mon Sep 17 00:00:00 2001 From: wukko Date: Tue, 25 Oct 2022 23:39:42 +0600 Subject: [PATCH] added an error if tiktok response is empty --- src/modules/services/tiktok.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/services/tiktok.js b/src/modules/services/tiktok.js index 1c78567..d5b652d 100644 --- a/src/modules/services/tiktok.js +++ b/src/modules/services/tiktok.js @@ -20,7 +20,9 @@ function selector(j, h, id) { let t = j["aweme_list"].filter((v) => { if (v["aweme_id"] == id) return true }) - return t[0] + if (t.length > 0) { + return t[0] + } else return false case "douyin": return j['item_list'][0] } @@ -50,7 +52,7 @@ 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}`;