mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-17 02:38:29 +00:00
api/tiktok: validate that redirected link is still tiktok
This commit is contained in:
parent
81a0d5e154
commit
d69100c68d
@ -24,10 +24,12 @@ 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));
|
||||||
|
if (host === "tiktok") {
|
||||||
postId = patternMatch?.postId;
|
postId = patternMatch?.postId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!postId) return { error: "fetch.short_link" };
|
if (!postId) return { error: "fetch.short_link" };
|
||||||
|
|
||||||
// should always be /video/, even for photos
|
// should always be /video/, even for photos
|
||||||
|
Loading…
Reference in New Issue
Block a user