diff --git a/index.php b/index.php index 5638e74..acd7424 100644 --- a/index.php +++ b/index.php @@ -8,13 +8,12 @@ function getContent($url) CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => true, - // Please change the user agent every time when the script stops working. - CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36', + CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0', CURLOPT_ENCODING => "utf-8", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_SSL_VERIFYHOST => false, - CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => 30, CURLOPT_MAXREDIRS => 10, ); @@ -27,6 +26,49 @@ function getContent($url) curl_close($ch); return strval($data); } + + function getKey($playable) + { + $ch = curl_init(); + $headers = [ + 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', + 'Accept-Encoding: gzip, deflate, br', + 'Accept-Language: en-US,en;q=0.9', + 'Range: bytes=0-20000' + ]; + + $options = array( + CURLOPT_URL => $playable, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => false, + CURLOPT_HTTPHEADER => $headers, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0', + CURLOPT_ENCODING => "utf-8", + CURLOPT_AUTOREFERER => true, + CURLOPT_CONNECTTIMEOUT => 30, + CURLOPT_SSL_VERIFYHOST => false, + CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_TIMEOUT => 30, + CURLOPT_MAXREDIRS => 10, + ); + curl_setopt_array( $ch, $options ); + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + } + $data = curl_exec($ch); + $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + $tmp = explode("vid:", $data); + if(count($tmp) > 1){ + $key = trim(explode("%", $tmp[1])[0]); + } + else + { + $key = ""; + } + return $key; + } ?> @@ -63,6 +105,7 @@ function getContent($url)

Download TikTok video easily!

+

Now supports watermark free version too and shorturls are subject to change!

Paste a video url below and press "Download" @@ -81,6 +124,8 @@ function getContent($url) $contentURL = explode("\"",$check[1])[0]; $thumb = explode("\"",explode("\"thumbnailUrl\":[\"", $resp)[1])[0]; $username = explode("/",explode("@",explode("\"",explode("\"url\":\"", $resp)[1])[0])[1])[0]; + $videoKey = getKey($contentURL); + $cleanVideo = "https://api2.musical.ly/aweme/v1/playwm/?video_id=$videoKey"; ?>
@@ -88,8 +133,8 @@ function getContent($url)
  • a video by @
  • -
  • -
  • If the video opens directly, try saving it by pressing CTRL+S or on phone, save from three dots in the bottom right corner
  • +
  • +
  • If the video opens directly, try saving it by pressing CTRL+S or on phone, save from three dots in the bottom left corner
@@ -110,5 +155,16 @@ function getContent($url)  
Developed by tufayel.rocks Copyright ©
+