tiktok: fix photo link parsing

This commit is contained in:
wukko 2024-01-28 13:23:00 +06:00
parent 8e24f91a06
commit c9947fc75d
2 changed files with 4 additions and 3 deletions

View file

@ -35,10 +35,11 @@ export default async function(obj) {
redirect: "manual",
headers: { "user-agent": userAgent }
}).then((r) => { return r.text() }).catch(() => { return false });
if (!html) return { error: 'ErrorCouldntFetch' };
if (html.slice(0, 17) === '<a href="https://' && html.includes('/video/')) {
postId = html.split('/video/')[1].split('?')[0].replace("/", '')
if (html.slice(0, 17) === '<a href="https://') {
postId = html.split('<a href="https://')[1].split('?')[0].split('/')[3]
} else if (html.slice(0, 32) === '<a href="https://m.tiktok.com/v/' && html.includes('/v/')) {
postId = html.split('/v/')[1].split('.html')[0].replace("/", '')
}

View file

@ -49,7 +49,7 @@
},
"tiktok": {
"alias": "tiktok videos, photos & audio",
"patterns": [":user/video/:postId", ":id", "t/:id"],
"patterns": [":user/video/:postId", ":id", "t/:id", ":user/photo/:postId"],
"subdomains": ["vt", "vm"],
"audioFormats": ["best", "m4a", "mp3"],
"enabled": true