public static function getVideoIDList($youtubeURL, $optionalparameters, &$playlistid, &$datalink) { $api_key = YouTubeGalleryMisc::getSettingValue('youtube_api_key'); if ($api_key == '') { return array(); } $playlistid = VideoSource_YoutubePlaylist::extractYouTubePlayListID($youtubeURL); $videolist = VideoSource_YoutubePlaylist::getPlaylistVideos($playlistid, $datalink, $api_key, $optionalparameters); return $videolist; }
public static function getVideoIDList($youtubeURL, $optionalparameters, &$playlistid) { $optionalparameters_arr = explode(',', $optionalparameters); $videolist = array(); $spq = implode('&', $optionalparameters_arr); $videolist = array(); $playlistid = VideoSource_YoutubePlaylist::extractYouTubePlayListID($youtubeURL); if ($playlistid == '') { return $videolist; } //playlist id not found //alteracoes projeto portal padrao require_once JPATH_ADMINISTRATOR . '/components/com_youtubegallery/google/_videos.php'; $videos = new YoutubeVideos(); $videos_raw = $videos->getVideosFromPlaylist($playlistid, 30, 'date'); for ($i = 0, $limit = count($videos_raw); $i < $limit; $i++) { $url = 'https://www.youtube.com/watch?v=' . $videos_raw[$i]->contentDetails->videoId; $videolist[] = $url; } return $videolist; // $url = 'http://gdata.youtube.com/feeds/api/playlists/'.$playlistid.($spq!='' ? '?'.$spq : '' ) ; //&max-results=10; // $xml=false; // $htmlcode=YouTubeGalleryMisc::getURLData($url); // if(strpos($htmlcode,'<?xml version')===false) // { // if(strpos($htmlcode,'Invalid id')===false) // return 'Cannot load data, Invalid id'; // return 'Cannot load data, no connection'; // } // $xml = simplexml_load_string($htmlcode); // if($xml){ // foreach ($xml->entry as $entry) // { // $media = $entry->children('http://search.yahoo.com/mrss/'); // $link = $media->group->player->attributes(); // if(isset($link)) // { // if(isset($link['url'])) // { // $videolist[] = $link['url']; // } // }//if(isset($link) // }//foreach ($xml->entry as $entry) // }//if($xml){ // return $videolist; }
public static function getVideoIDList($youtubeURL, $optionalparameters, &$playlistid) { $optionalparameters_arr = explode(',', $optionalparameters); $videolist = array(); $spq = implode('&', $optionalparameters_arr); $videolist = array(); $playlistid = VideoSource_YoutubePlaylist::extractYouTubePlayListID($youtubeURL); if ($playlistid == '') { return $videolist; } //playlist id not found $url = 'http://gdata.youtube.com/feeds/api/playlists/' . $playlistid . ($spq != '' ? '?' . $spq : ''); //&max-results=10; $xml = false; $htmlcode = YouTubeGalleryMisc::getURLData($url); if (strpos($htmlcode, '<?xml version') === false) { if (strpos($htmlcode, 'Invalid id') === false) { return 'Cannot load data, Invalid id'; } return 'Cannot load data, no connection'; } $xml = simplexml_load_string($htmlcode); if ($xml) { foreach ($xml->entry as $entry) { $media = $entry->children('http://search.yahoo.com/mrss/'); $link = $media->group->player->attributes(); if (isset($link)) { if (isset($link['url'])) { $videolist[] = $link['url']; } } //if(isset($link) } //foreach ($xml->entry as $entry) } //if($xml){ return $videolist; }