/** * Create a Youtube media * * @param string $url * @return array */ public function create(string $url) : array { $config = $this->config; /* @service YoutubeDriver */ $service = new YoutubeDriver(['key' => $config['api_key']]); $videoId = $service->parseVIdFromURL($url); $video = $service->getVideoInfo($videoId); return (array) $video; }
/** * @expectedException \Exception */ public function testParseVIdException() { $vId = $this->youtube->parseVIdFromURL('http://www.facebook.com'); }