From 585811903ae94b978497a18886445e07ac1880f4 Mon Sep 17 00:00:00 2001 From: Tufayel Ahmed <39314838+TufayelLUS@users.noreply.github.com> Date: Mon, 11 May 2020 22:11:40 +0600 Subject: [PATCH] Added watermark free support including shorturl After research on available codes added additional support for watermark-free version downloading and also supports short URLs now(subject to change anytime) --- index.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 5 deletions(-) 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)