mirror of
https://github.com/imputnet/cobalt.git
synced 2026-10-24 19:11:16 +00:00
api/tiktok: validate that redirected link is still tiktok
This commit is contained in:
parent
81a0d5e154
commit
d69100c68d
1 changed files with 4 additions and 2 deletions
|
|
@ -24,8 +24,10 @@ export default async function(obj) {
|
|||
|
||||
if (html.startsWith('<a href="https://')) {
|
||||
const extractedURL = html.split('<a href="')[1].split('?')[0];
|
||||
const { patternMatch } = extract(normalizeURL(extractedURL));
|
||||
postId = patternMatch?.postId;
|
||||
const { host, patternMatch } = extract(normalizeURL(extractedURL));
|
||||
if (host === "tiktok") {
|
||||
postId = patternMatch?.postId;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!postId) return { error: "fetch.short_link" };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue