From 1d365f54a2655b6eb00baf29ea2afd2bb5bed0b2 Mon Sep 17 00:00:00 2001 From: Tufayel Ahmed <39314838+TufayelLUS@users.noreply.github.com> Date: Fri, 18 Sep 2020 14:12:52 +0600 Subject: [PATCH] Fixed HTTP REFERER issue when downloading Unfortunately, it doesn't work for video with a watermark as no HTTP referer is passed when it is opened directly. --- index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 3b9d06f..0d10146 100644 --- a/index.php +++ b/index.php @@ -10,7 +10,8 @@ function getContent($url, $geturl = false) CURLOPT_FOLLOWLOCATION => true, CURLOPT_USERAGENT => 'okhttp', CURLOPT_ENCODING => "utf-8", - CURLOPT_AUTOREFERER => true, + CURLOPT_AUTOREFERER => false, + CURLOPT_REFERER => 'https://www.tiktok.com/', CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, @@ -49,7 +50,8 @@ function getContent($url, $geturl = false) 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_AUTOREFERER => false, + CURLOPT_REFERER => 'https://www.tiktok.com/', CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false,