api/tiktok: validate that redirected link is still tiktok

This commit is contained in:
wukko
2025-06-26 21:32:31 +06:00
parent 81a0d5e154
commit d69100c68d

View File

@@ -24,8 +24,10 @@ export default async function(obj) {
if (html.startsWith('<a href="https://')) { if (html.startsWith('<a href="https://')) {
const extractedURL = html.split('<a href="')[1].split('?')[0]; const extractedURL = html.split('<a href="')[1].split('?')[0];
const { patternMatch } = extract(normalizeURL(extractedURL)); const { host, patternMatch } = extract(normalizeURL(extractedURL));
postId = patternMatch?.postId; if (host === "tiktok") {
postId = patternMatch?.postId;
}
} }
} }
if (!postId) return { error: "fetch.short_link" }; if (!postId) return { error: "fetch.short_link" };