From 97850e08af9b7b0af1b1cf64340202d76ca2bfd7 Mon Sep 17 00:00:00 2001 From: Damir Modyarov Date: Tue, 21 May 2024 16:17:29 +0300 Subject: [PATCH] tiktok: improve link parsing --- src/modules/processing/services/tiktok.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/processing/services/tiktok.js b/src/modules/processing/services/tiktok.js index 682a2e77..122e0998 100644 --- a/src/modules/processing/services/tiktok.js +++ b/src/modules/processing/services/tiktok.js @@ -1,14 +1,14 @@ import { genericUserAgent } from "../../config.js"; import { updateCookie } from "../cookie/manager.js"; +import { extract } from "../url.js"; import Cookie from "../cookie/cookie.js"; -const fullDomain = "https://tiktok.com/"; const shortDomain = "https://vt.tiktok.com/"; export const cookie = new Cookie({}) export default async function(obj) { - let postId = obj.postId || false - let username = obj.user || false + let postId = obj.postId + let username = obj.user if (!username || !postId) { let html = await fetch(`${shortDomain}${obj.id}`, { @@ -20,16 +20,16 @@ export default async function(obj) { if (!html) return { error: 'ErrorCouldntFetch' }; - if (html.slice(0, 17) === '