added support for douyin

- full support for douyin (no watermark)
- fixed up some tiktok stuff in the module
This commit is contained in:
wukko
2022-07-30 16:58:14 +06:00
parent 89d82f4999
commit e9a67e1f48
6 changed files with 62 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import twitter from "./services/twitter.js";
import youtube from "./services/youtube.js";
import vk from "./services/vk.js";
import tiktok from "./services/tiktok.js";
import douyin from "./services/douyin.js";
export default async function (host, patternMatch, url, ip, lang, format, quality) {
try {
@@ -87,7 +88,7 @@ export default async function (host, patternMatch, url, ip, lang, format, qualit
}) : apiJSON(0, { t: r.error });
} else throw Error()
case "tiktok":
if ((patternMatch["user"] && patternMatch["type"] == "video" && patternMatch["postId"] && patternMatch["postId"].length <= 21) ||
if ((patternMatch["user"] && patternMatch["postId"] && patternMatch["postId"].length <= 21) ||
(patternMatch["id"] && patternMatch["id"].length <= 13)) {
let r = await tiktok({
postId: patternMatch["postId"],
@@ -99,6 +100,19 @@ export default async function (host, patternMatch, url, ip, lang, format, qualit
filename: r.filename, salt: process.env.streamSalt
}) : apiJSON(0, { t: r.error });
} else throw Error()
case "douyin":
if ((patternMatch["postId"] && patternMatch["postId"].length <= 21) ||
(patternMatch["id"] && patternMatch["id"].length <= 13)) {
let r = await douyin({
postId: patternMatch["postId"],
id: patternMatch["id"], lang: lang,
});
return (!r.error) ? apiJSON(2, {
type: "bridge", u: r.urls, lang: lang,
service: host, ip: ip,
filename: r.filename, salt: process.env.streamSalt
}) : apiJSON(0, { t: r.error });
} else throw Error()
default:
return apiJSON(0, { t: errorUnsupported(lang) })
}