api/tiktok: fix url patterns

This commit is contained in:
wukko 2024-10-12 22:06:54 +06:00
parent 0d2e300fbe
commit 6ad838b649
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
3 changed files with 6 additions and 6 deletions

View file

@ -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,

View file

@ -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"],
},

View file

@ -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('<a href="https://')) {
const extractedURL = html.split('<a href="')[1].split('?')[0];
const { patternMatch } = extract(extractedURL);
postId = patternMatch.postId
postId = patternMatch.postId;
}
}
if (!postId) return { error: "fetch.short_link" };