mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-14 01:08:27 +00:00
Fix TikTok download issue
This commit is contained in:
parent
083e61e111
commit
e80d2ec01e
@ -3,6 +3,7 @@
|
||||
"maxVideoDuration": 1920000,
|
||||
"maxAudioDuration": 4200000,
|
||||
"genericUserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
|
||||
"genericUserAgentTikTok": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)",
|
||||
"authorInfo": {
|
||||
"name": "wukko",
|
||||
"link": "https://wukko.me/",
|
||||
|
@ -12,6 +12,7 @@ export const
|
||||
maxVideoDuration = config.maxVideoDuration,
|
||||
maxAudioDuration = config.maxAudioDuration,
|
||||
genericUserAgent = config.genericUserAgent,
|
||||
genericUserAgentTikTok = config.genericUserAgentTikTok,
|
||||
repo = packageJson["bugs"]["url"].replace('/issues', ''),
|
||||
authorInfo = config.authorInfo,
|
||||
supportedLanguages = config.supportedLanguages,
|
||||
@ -19,4 +20,4 @@ export const
|
||||
internetExplorerRedirect = config.internetExplorerRedirect,
|
||||
donations = config.donations,
|
||||
ffmpegArgs = config.ffmpegArgs,
|
||||
supportedAudio = config.supportedAudio
|
||||
supportedAudio = config.supportedAudio;
|
||||
|
@ -1,12 +1,12 @@
|
||||
import got from "got";
|
||||
import loc from "../../localization/manager.js";
|
||||
import { genericUserAgent } from "../config.js";
|
||||
import { genericUserAgentTikTok } from "../config.js";
|
||||
import { unicodeDecode } from "../sub/utils.js";
|
||||
|
||||
export default async function(obj) {
|
||||
try {
|
||||
if (!obj.postId) {
|
||||
let html = await got.get(`https://vt.tiktok.com/${obj.id}`, { headers: { "user-agent": genericUserAgent } });
|
||||
let html = await got.get(`https://vt.tiktok.com/${obj.id}`, { headers: { "user-agent": genericUserAgentTikTok } });
|
||||
html.on('error', (err) => {
|
||||
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'tiktok') };
|
||||
});
|
||||
@ -18,7 +18,7 @@ export default async function(obj) {
|
||||
}
|
||||
}
|
||||
if (!obj.noWatermark && !obj.isAudioOnly) {
|
||||
let html = await got.get(`https://tiktok.com/@video/video/${obj.postId}`, { headers: { "user-agent": genericUserAgent } });
|
||||
let html = await got.get(`https://tiktok.com/@video/video/${obj.postId}`, { headers: { "user-agent": genericUserAgentTikTok } });
|
||||
html.on('error', (err) => {
|
||||
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'tiktok') };
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user