From 2d5a6da1befc1d4d9ee4abb8546f9927115fa323 Mon Sep 17 00:00:00 2001 From: Tufayel Ahmed <39314838+TufayelLUS@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:21:31 +0600 Subject: [PATCH] Fixed bugs due to recent TikTok changes Certain parameters were changed on the TikTok platform. Adjusted necessary parts of the script to get it working again. --- index.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index 5dd99f0..ddc09f1 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,6 @@ true, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => true, - CURLOPT_USERAGENT => 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Mobile Safari/537.36', + CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36', CURLOPT_ENCODING => "utf-8", CURLOPT_AUTOREFERER => false, CURLOPT_COOKIEJAR => 'cookie.txt', @@ -138,6 +139,7 @@ function getKey($playable) $tmp = explode("vid:", $data); if (count($tmp) > 1) { $key = trim(explode("%", $tmp[1])[0]); + $key = trim(explode(".", $key)[0]); } else { $key = ""; } @@ -235,14 +237,13 @@ function escape_sequence_decode($str) if (isset($_POST['tiktok-url']) && !empty($_POST['tiktok-url'])) { $url = trim($_POST['tiktok-url']); $resp = getContent($url); - //echo "$resp"; $check = explode('"downloadAddr":"', $resp); if (count($check) > 1) { $contentURL = explode("\"", $check[1])[0]; $contentURL = escape_sequence_decode($contentURL); $thumb = explode("\"", explode('"dynamicCover":"', $resp)[1])[0]; $thumb = escape_sequence_decode($thumb); - $username = explode('/', explode('rel="canonical" href="https://www.tiktok.com/@', $resp)[1])[0]; + $username = explode('"', explode('uniqueId":"', $resp)[1])[0]; $create_time = explode('"', explode('"createTime":"', $resp)[1])[0]; $dt = new DateTime("@$create_time"); $create_time = $dt->format("d M Y H:i:s A"); @@ -275,7 +276,6 @@ function escape_sequence_decode($str) });