mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-17 22:00:00 +00:00
tiktok: fix photo link parsing
This commit is contained in:
parent
8e24f91a06
commit
c9947fc75d
2 changed files with 4 additions and 3 deletions
|
@ -35,10 +35,11 @@ export default async function(obj) {
|
||||||
redirect: "manual",
|
redirect: "manual",
|
||||||
headers: { "user-agent": userAgent }
|
headers: { "user-agent": userAgent }
|
||||||
}).then((r) => { return r.text() }).catch(() => { return false });
|
}).then((r) => { return r.text() }).catch(() => { return false });
|
||||||
|
|
||||||
if (!html) return { error: 'ErrorCouldntFetch' };
|
if (!html) return { error: 'ErrorCouldntFetch' };
|
||||||
|
|
||||||
if (html.slice(0, 17) === '<a href="https://' && html.includes('/video/')) {
|
if (html.slice(0, 17) === '<a href="https://') {
|
||||||
postId = html.split('/video/')[1].split('?')[0].replace("/", '')
|
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/')) {
|
} 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("/", '')
|
postId = html.split('/v/')[1].split('.html')[0].replace("/", '')
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
},
|
},
|
||||||
"tiktok": {
|
"tiktok": {
|
||||||
"alias": "tiktok videos, photos & audio",
|
"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"],
|
"subdomains": ["vt", "vm"],
|
||||||
"audioFormats": ["best", "m4a", "mp3"],
|
"audioFormats": ["best", "m4a", "mp3"],
|
||||||
"enabled": true
|
"enabled": true
|
||||||
|
|
Loading…
Reference in a new issue