fixed tiktok support and updated ytdl-core version
This commit is contained in:
parent
083e61e111
commit
1acfb14d2c
2 changed files with 6 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "cobalt",
|
"name": "cobalt",
|
||||||
"description": "save what you love",
|
"description": "save what you love",
|
||||||
"version": "3.3.5",
|
"version": "3.3.6",
|
||||||
"author": "wukko",
|
"author": "wukko",
|
||||||
"exports": "./src/cobalt.js",
|
"exports": "./src/cobalt.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -32,6 +32,6 @@
|
||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"url-pattern": "1.0.3",
|
"url-pattern": "1.0.3",
|
||||||
"xml-js": "^1.6.11",
|
"xml-js": "^1.6.11",
|
||||||
"ytdl-core": "4.11.0"
|
"ytdl-core": "4.11.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,12 @@ import loc from "../../localization/manager.js";
|
||||||
import { genericUserAgent } from "../config.js";
|
import { genericUserAgent } from "../config.js";
|
||||||
import { unicodeDecode } from "../sub/utils.js";
|
import { unicodeDecode } from "../sub/utils.js";
|
||||||
|
|
||||||
|
let userAgent = genericUserAgent.split(' Chrome/1')[0]
|
||||||
|
|
||||||
export default async function(obj) {
|
export default async function(obj) {
|
||||||
try {
|
try {
|
||||||
if (!obj.postId) {
|
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": userAgent } });
|
||||||
html.on('error', (err) => {
|
html.on('error', (err) => {
|
||||||
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'tiktok') };
|
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'tiktok') };
|
||||||
});
|
});
|
||||||
|
@ -18,7 +20,7 @@ export default async function(obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!obj.noWatermark && !obj.isAudioOnly) {
|
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": userAgent } });
|
||||||
html.on('error', (err) => {
|
html.on('error', (err) => {
|
||||||
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'tiktok') };
|
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'tiktok') };
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue