Addressing PR comments about not using hardcoded string.

This commit is contained in:
Skyler Mäntysaari 2023-02-17 22:14:01 +02:00
parent 288f87504c
commit 72ea5d43fd
2 changed files with 6 additions and 1 deletions

View file

@ -3,6 +3,7 @@ namespace App\Controllers;
use App\Helpers\Cookies;
use App\Helpers\Misc;
use TikScraper\Constants\UserAgents as TikScraperUserAgents;
class ProxyController {
const VALID_TIKTOK_DOMAINS = [
@ -12,7 +13,7 @@ class ProxyController {
static public function stream() {
self::checkUrl();
$url = $_GET['url'];
$config['USER_AGENT'] = Misc::env("user_agent", "Mozilla/5.0 (Android 12; Mobile; rv:109.0) Gecko/109.0 Firefox/109.0");
$config['user_agent'] = Misc::env("USER_AGENT", TikScraperUserAgents::DEFAULT);
$streamer = new \TikScraper\Stream($config);
$streamer->url($url);
}

View file

@ -7,6 +7,8 @@ use App\Cache\RedisCache;
use App\Constants\CacheMethods;
use App\Models\BaseTemplate;
use TikScraper\Constants\UserAgents as TikScraperUserAgents;
class Wrappers {
/**
* Setup of Latte template engine
@ -162,6 +164,8 @@ class Wrappers {
}
}
$options["user_agent"] = Misc::env("USER_AGENT", TikScraperUserAgents::DEFAULT);
return new \TikScraper\Api($options, $cacheEngine);
}
}