api/tiktok: fix url patterns
This commit is contained in:
parent
0d2e300fbe
commit
6ad838b649
3 changed files with 6 additions and 6 deletions
|
@ -127,7 +127,7 @@ export default async function({ host, patternMatch, params }) {
|
||||||
case "tiktok":
|
case "tiktok":
|
||||||
r = await tiktok({
|
r = await tiktok({
|
||||||
postId: patternMatch.postId,
|
postId: patternMatch.postId,
|
||||||
id: patternMatch.id,
|
shortLink: patternMatch.shortLink,
|
||||||
fullAudio: params.tiktokFullAudio,
|
fullAudio: params.tiktokFullAudio,
|
||||||
isAudioOnly,
|
isAudioOnly,
|
||||||
h265: params.tiktokH265,
|
h265: params.tiktokH265,
|
||||||
|
|
|
@ -111,10 +111,10 @@ export const services = {
|
||||||
tiktok: {
|
tiktok: {
|
||||||
patterns: [
|
patterns: [
|
||||||
":user/video/:postId",
|
":user/video/:postId",
|
||||||
":id",
|
":shortLink",
|
||||||
"t/:id",
|
"t/:shortLink",
|
||||||
":user/photo/:postId",
|
":user/photo/:postId",
|
||||||
"v/:id.html"
|
"v/:postId.html"
|
||||||
],
|
],
|
||||||
subdomains: ["vt", "vm", "m"],
|
subdomains: ["vt", "vm", "m"],
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default async function(obj) {
|
||||||
let postId = obj.postId;
|
let postId = obj.postId;
|
||||||
|
|
||||||
if (!postId) {
|
if (!postId) {
|
||||||
let html = await fetch(`${shortDomain}${obj.id}`, {
|
let html = await fetch(`${shortDomain}${obj.shortLink}`, {
|
||||||
redirect: "manual",
|
redirect: "manual",
|
||||||
headers: {
|
headers: {
|
||||||
"user-agent": genericUserAgent.split(' Chrome/1')[0]
|
"user-agent": genericUserAgent.split(' Chrome/1')[0]
|
||||||
|
@ -24,7 +24,7 @@ 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(extractedURL);
|
const { patternMatch } = extract(extractedURL);
|
||||||
postId = patternMatch.postId
|
postId = patternMatch.postId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!postId) return { error: "fetch.short_link" };
|
if (!postId) return { error: "fetch.short_link" };
|
||||||
|
|
Loading…
Reference in a new issue