diff --git a/package.json b/package.json
index e80c6cff..aa320744 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "cobalt",
"description": "save what you love",
- "version": "3.5.2",
+ "version": "3.5.4",
"author": "wukko",
"exports": "./src/cobalt.js",
"type": "module",
diff --git a/src/front/cobalt.js b/src/front/cobalt.js
index 856c2b23..0c82b7c7 100644
--- a/src/front/cobalt.js
+++ b/src/front/cobalt.js
@@ -1,6 +1,6 @@
let isIOS = navigator.userAgent.toLowerCase().match("iphone os");
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 switchers = {
diff --git a/src/modules/changelog/changelog.json b/src/modules/changelog/changelog.json
index e9b0cf95..c01f1e42 100644
--- a/src/modules/changelog/changelog.json
+++ b/src/modules/changelog/changelog.json
@@ -1,7 +1,7 @@
{
"current": {
- "title": "here's what's up with tiktok support",
- "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 github.\n\nbig tech companies really don't like it when people have freedom, huh?"
+ "title": "tiktok support is back :D (3.5.4)",
+ "content": "you can download videos, sounds, and images from tiktok again!\nhuge thank you to @minzique 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": [{
"title": "vk clips support, improved changelog system, and less bugs (3.5.2)",
diff --git a/src/modules/services/tiktok.js b/src/modules/services/tiktok.js
index 2655652e..32eba310 100644
--- a/src/modules/services/tiktok.js
+++ b/src/modules/services/tiktok.js
@@ -7,17 +7,17 @@ let userAgent = genericUserAgent.split(' Chrome/1')[0]
let config = {
tiktok: {
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: {
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) {
switch (h) {
case "tiktok":
- return j["aweme_detail"]
+ return j["aweme_details"][0]
case "douyin":
return j['item_list'][0]
}
@@ -35,7 +35,7 @@ export default async function(obj) {
}
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) => {
return { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', obj.host) };
});
diff --git a/src/modules/servicesConfig.json b/src/modules/servicesConfig.json
index 5efa1d43..8a5f9755 100644
--- a/src/modules/servicesConfig.json
+++ b/src/modules/servicesConfig.json
@@ -64,7 +64,7 @@
"tiktok": {
"patterns": [":user/video/:postId", ":id", "t/:id"],
"audioFormats": ["best", "m4a", "mp3"],
- "enabled": false
+ "enabled": true
},
"douyin": {
"patterns": ["video/:postId", ":id"],