Inheritance: extends Youtube
 public static function getVideoIDList($youtubeURL, $optionalparameters, &$userid)
 {
     $optionalparameters_arr = explode(',', $optionalparameters);
     $videolist = array();
     $spq = implode('&', $optionalparameters_arr);
     $userid = VideoSource_YoutubeUserFavorites::extractYouTubeUserID($youtubeURL);
     if ($userid == '') {
         return $videolist;
     }
     //user id not found
     //alteracoes projeto portal padrao
     require_once JPATH_ADMINISTRATOR . '/components/com_youtubegallery/google/_videos.php';
     $videos = new YoutubeVideos();
     $channelID = $videos->getChannelId($userid);
     @($channelID = $channelID[0]);
     $video_raw = $videos->getVideosFromChannel($channelID, 30, 'date');
     if ($userid == '' || empty($channelID)) {
         return $videolist;
     }
     //user id not found
     for ($i = 0, $limit = count($video_raw); $i < $limit; $i++) {
         $videolist[] = 'https://www.youtube.com/watch?v=' . $video_raw[$i]['id']['videoId'];
     }
     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();
     $keywords = VideoSource_YoutubeSearch::extractYouTubeSearchKeywords($youtubeURL);
     // echo '$keywords='.$keywords.'<br/>';
     // die;
     require_once JPATH_ADMINISTRATOR . '/components/com_youtubegallery/google/_videos.php';
     $videos = new YoutubeVideos();
     $videos_raw = $videos->getVideosFromSearch($keywords);
     $videolist = array();
     for ($i = 0, $limit = count($videos_raw); $i < $limit; $i++) {
         $url = 'https://www.youtube.com/watch?v=' . $videos_raw[$i]->id->videoId;
         $videolist[] = $url;
     }
     return $videolist;
 }
Beispiel #4
0
 public static function getYouTubeVideoData($videoid, &$blankArray)
 {
     if (phpversion() < 5) {
         return "Update to PHP 5+";
     }
     //
     require_once JPATH_ADMINISTRATOR . '/components/com_youtubegallery/google/_videos.php';
     $youtubeVideos = new YoutubeVideos();
     // var_dump($videoid);
     $video_info = $youtubeVideos->getVideoInfo($videoid);
     // echo "<pre>";
     // var_dump($video_info['items']);
     if (isset($video_info['items'])) {
         $video_info = $video_info['items'][0];
     }
     $blankArray['videoid'] = $videoid;
     $blankArray['title'] = $video_info['snippet']['title'];
     $blankArray['description'] = $video_info['snippet']['description'];
     if (isset($video_info['snippet']['publishedAt'])) {
         $ts = strtotime($video_info['snippet']['publishedAt']);
         $blankArray['publisheddate'] = date("Y-m-d H:i:s", $ts);
     }
     if (isset($video_info['contentDetails']['duration'])) {
         $date = new DateTime('1970-01-01');
         $date->add(new DateInterval($video_info['contentDetails']['duration']));
         $seconds = $date->format('s');
         $minutes = $date->format('i');
         $hours = $date->format('H');
         $seconds = $hours * 60 * 60 + $minutes * 60 + $seconds;
         $blankArray['duration'] = $seconds;
     }
     if (count($video_info['snippet']['thumbnails']) > 0) {
         $blankArray['imageurl'] = array();
         foreach ($video_info['snippet']['thumbnails'] as $k => $v) {
             $blankArray['imageurl'][] = $v;
         }
         $blankArray['imageurl'] = implode(', ', $blankArray['imageurl']);
     }
     return '';
 }