private function getVideoFromURL($title, $url) { $url = parse_url($url); parse_str($url["query"], $query); if (strpos($url["host"], "youtube.com") !== false) { $source = "youtube"; $id = $query["v"]; $thumb = "https://img.youtube.com/vi/" . $id . "/hqdefault.jpg"; } if ($source && $id && $thumb) { return VideoSource::create($title, $source, $id, $thumb); } return null; }