fixed tiktok
This commit is contained in:
parent
ad0846ac73
commit
e3b9fccfc3
5 changed files with 9 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "cobalt",
|
"name": "cobalt",
|
||||||
"description": "save what you love",
|
"description": "save what you love",
|
||||||
"version": "3.5.2",
|
"version": "3.5.4",
|
||||||
"author": "wukko",
|
"author": "wukko",
|
||||||
"exports": "./src/cobalt.js",
|
"exports": "./src/cobalt.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
let isIOS = navigator.userAgent.toLowerCase().match("iphone os");
|
let isIOS = navigator.userAgent.toLowerCase().match("iphone os");
|
||||||
let isFirefox = navigator.userAgent.toLowerCase().match("firefox/");
|
let isFirefox = navigator.userAgent.toLowerCase().match("firefox/");
|
||||||
let version = 9;
|
let version = 10;
|
||||||
let regex = new RegExp(/https:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/);
|
let regex = new RegExp(/https:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/);
|
||||||
|
|
||||||
let switchers = {
|
let switchers = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"current": {
|
"current": {
|
||||||
"title": "here's what's up with tiktok support",
|
"title": "tiktok support is back :D (3.5.4)",
|
||||||
"content": "recently tiktok pushed a breaking change to their api, and long story short: cobalt can't get tiktok video info anymore (for now).\ni had to disable support for tiktok until i figure out how to solve this issue. sorry for any caused inconvenience.\nactually, blame tiktok for this. they try to gatekeep access to content they don't own.\nby doing this, they force people to watch ads and give away personal information on their platform, along with making it impossible to archive content in any viable form.\n\nif you want to help me figure out the fix faster, you can do it on <a class=\"text-backdrop\" href=\"{repo}/blob/current/src/modules/services/tiktok.js\" target=\"_blank\">github</a>.\n\nbig tech companies really don't like it when people have freedom, huh?"
|
"content": "you can download videos, sounds, and images from tiktok again!\nhuge thank you to <a class=\"text-backdrop\" href=\"https://github.com/minzique\" target=\"_blank\">@minzique</a> for finding another api endpoint that works.\n\nif you don't want to see this popup anymore, you can disable it in settings > other."
|
||||||
},
|
},
|
||||||
"history": [{
|
"history": [{
|
||||||
"title": "vk clips support, improved changelog system, and less bugs (3.5.2)",
|
"title": "vk clips support, improved changelog system, and less bugs (3.5.2)",
|
||||||
|
|
|
@ -7,17 +7,17 @@ let userAgent = genericUserAgent.split(' Chrome/1')[0]
|
||||||
let config = {
|
let config = {
|
||||||
tiktok: {
|
tiktok: {
|
||||||
short: "https://vt.tiktok.com/",
|
short: "https://vt.tiktok.com/",
|
||||||
api: "https://api.tiktokv.com/aweme/v1/aweme/detail/?aweme_id=",
|
api: "https://api.tiktokv.com/aweme/v1/multi/aweme/detail/?aweme_ids=%5B{postId}%5D&version_code=26.2.0&app_name=musical_ly&channel=App&device_id=null&os_version=14.4.2&device_platform=iphone&device_type=iPhone9", // thanks to https://github.com/wukko/cobalt/pull/41#issue-1380090574
|
||||||
},
|
},
|
||||||
douyin: {
|
douyin: {
|
||||||
short: "https://v.douyin.com/",
|
short: "https://v.douyin.com/",
|
||||||
api: "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=",
|
api: "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids={postId}",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function selector(j, h) {
|
function selector(j, h) {
|
||||||
switch (h) {
|
switch (h) {
|
||||||
case "tiktok":
|
case "tiktok":
|
||||||
return j["aweme_detail"]
|
return j["aweme_details"][0]
|
||||||
case "douyin":
|
case "douyin":
|
||||||
return j['item_list'][0]
|
return j['item_list'][0]
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export default async function(obj) {
|
||||||
}
|
}
|
||||||
if (!obj.postId) return { error: loc(obj.lang, 'ErrorCantGetID') };
|
if (!obj.postId) return { error: loc(obj.lang, 'ErrorCantGetID') };
|
||||||
|
|
||||||
let detail = await got.get(`${config[obj.host]["api"]}${obj.postId}`);
|
let detail = await got.get(config[obj.host]["api"].replace("{postId}", obj.postId), { headers: {"User-Agent":"TikTok 26.2.0 rv:262018 (iPhone; iOS 14.4.2; en_US) Cronet"} });
|
||||||
detail.on('error', (err) => {
|
detail.on('error', (err) => {
|
||||||
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', obj.host) };
|
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', obj.host) };
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
"tiktok": {
|
"tiktok": {
|
||||||
"patterns": [":user/video/:postId", ":id", "t/:id"],
|
"patterns": [":user/video/:postId", ":id", "t/:id"],
|
||||||
"audioFormats": ["best", "m4a", "mp3"],
|
"audioFormats": ["best", "m4a", "mp3"],
|
||||||
"enabled": false
|
"enabled": true
|
||||||
},
|
},
|
||||||
"douyin": {
|
"douyin": {
|
||||||
"patterns": ["video/:postId", ":id"],
|
"patterns": ["video/:postId", ":id"],
|
||||||
|
|
Loading…
Reference in a new issue