From 6ad838b6498d11934f4b70f0b368778535d75c89 Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 12 Oct 2024 22:06:54 +0600 Subject: [PATCH] api/tiktok: fix url patterns --- api/src/processing/match.js | 2 +- api/src/processing/service-config.js | 6 +++--- api/src/processing/services/tiktok.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/src/processing/match.js b/api/src/processing/match.js index ffb92c23..b0022d08 100644 --- a/api/src/processing/match.js +++ b/api/src/processing/match.js @@ -127,7 +127,7 @@ export default async function({ host, patternMatch, params }) { case "tiktok": r = await tiktok({ postId: patternMatch.postId, - id: patternMatch.id, + shortLink: patternMatch.shortLink, fullAudio: params.tiktokFullAudio, isAudioOnly, h265: params.tiktokH265, diff --git a/api/src/processing/service-config.js b/api/src/processing/service-config.js index 8d8bf4ac..a2136ad0 100644 --- a/api/src/processing/service-config.js +++ b/api/src/processing/service-config.js @@ -111,10 +111,10 @@ export const services = { tiktok: { patterns: [ ":user/video/:postId", - ":id", - "t/:id", + ":shortLink", + "t/:shortLink", ":user/photo/:postId", - "v/:id.html" + "v/:postId.html" ], subdomains: ["vt", "vm", "m"], }, diff --git a/api/src/processing/services/tiktok.js b/api/src/processing/services/tiktok.js index 3c70e033..e205ce54 100644 --- a/api/src/processing/services/tiktok.js +++ b/api/src/processing/services/tiktok.js @@ -12,7 +12,7 @@ export default async function(obj) { let postId = obj.postId; if (!postId) { - let html = await fetch(`${shortDomain}${obj.id}`, { + let html = await fetch(`${shortDomain}${obj.shortLink}`, { redirect: "manual", headers: { "user-agent": genericUserAgent.split(' Chrome/1')[0] @@ -24,7 +24,7 @@ export default async function(obj) { if (html.startsWith('