get('/stream', function () { if (!isset($_GET['url'])) { die('You need to send a url!'); } $url = $_GET['url']; if (!filter_var($url, FILTER_VALIDATE_URL) || !isValidDomain($url)) { die('Not a valid URL'); } if (isset($_GET['download'])) { // Download (video only) $downloader = new \Sovit\TikTok\Download(); $downloader->url($url, "tiktok-video", 'mp4'); } else { // Stream $streamer = new \Sovit\TikTok\Stream(); $streamer->stream($url); } });