Applied a fix on watermark free API

I found that the user agent matters when you access an API. I changed it and somehow it is working now! Cheers!
This commit is contained in:
Tufayel Ahmed 2020-08-27 22:21:24 +06:00 committed by GitHub
parent 7a55dac248
commit 4da5bd739a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ function getContent($url, $geturl = false)
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0',
CURLOPT_USERAGENT => 'okhttp',
CURLOPT_ENCODING => "utf-8",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 30,
@ -131,7 +131,7 @@ function getContent($url, $geturl = false)
$thumb = explode("\"",explode('og:image" content="', $resp)[1])[0];
$username = explode("/",explode("@",explode("\"",explode("\"canonicalHref\":\"", $resp)[1])[0])[1])[0];
$videoKey = getKey($contentURL);
$cleanVideo = "https://api.tiktokv.com/aweme/v1/playwm/?video_id=$videoKey&line=0&ratio=default&media_type=4&vr_type=0";
$cleanVideo = "https://api2-16-h2.musical.ly/aweme/v1/play/?video_id=$videoKey&vr_type=0&is_play_url=1&source=PackSourceEnum_PUBLISH&media_type=4";
$cleanVideo = getContent($cleanVideo, true);
?>