• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Gdata_YouTube类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Zend_Gdata_YouTube的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube类的具体用法?PHP Zend_Gdata_YouTube怎么用?PHP Zend_Gdata_YouTube使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Zend_Gdata_YouTube类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: swfAction

 /**
  * action swf untuk nampilin video $_uname swf player
  */
 public function swfAction()
 {
     $youtube = new Zend_Gdata_YouTube();
     try {
         $lists = $youtube->getUserUploads(self::$_uname);
     } catch (Exception $ex) {
         echo $ex->getMessage();
         exit;
     }
     // masih ngawur, masih belum selesai, klo dibikin gini cuma keluar 1 video :p
     // ntar aja dilanjut, ngantukkkkkkkkkkkkkkkkk
     foreach ($lists as $vids) {
         $pub = new Zend_Date($vids->getPublished()->getText(), Zend_Date::ISO_8601);
         // lempar ke view script
         $this->view->videoTitle = $this->view->escape($vids->getVideoTitle());
         $this->view->published = $pub;
         $this->view->videoTags = join(', ', $vids->getVideoTags());
         $this->view->desc = $this->view->escape($vids->getVideoDescription());
         if ($vids->isVideoEmbeddable()) {
             $this->view->url = 'http://www.youtube.com/v/' . $vids->getVideoId() . '&fs=1';
             $this->view->width = 320;
             $height->view->height = 240;
         }
     }
 }
开发者ID:vianziro,项目名称:simuktiblogspot,代码行数:28,代码来源:IndexController.php


示例2: getApiComments

	public function getApiComments($videoId)	
	{
	  echo "Checking for comment on: {$videoId}";
	  $yt = new Zend_Gdata_YouTube();
	  // set the version to 2 to retrieve a version 2 feed
	  $yt->setMajorProtocolVersion(2);
	  $commentFeed = $yt->getVideoCommentFeed($videoId);
	  $count = 1;
	  foreach ($commentFeed as $commentEntry) 
	  {
	  	if (!CommentData::commentExists($commentEntry->id))
				{  
	  				echo 'YouTube Comment: ' . $commentEntry->title->text . "\n";
	  				$c=CommentData::create();
					$c->setMessageId($this->getId());
					$c->setCommentId($commentEntry->id);
					$c->setComment($commentEntry->content);
					$c->setAuthorName($commentEntry->author[0]->name);
					$c->setServiceId('3');
					$tZulu=$commentEntry->published;
					$toStrip=array("T", "Z");
					$tZuluStripped=str_replace($toStrip, " ", $tZulu);
					$tZuluStrippedUnix=strtotime($tZuluStripped);
					$gooddate=date('Y-m-d H:i:s', $tZuluStrippedUnix);		
					$c->setPermalink($commentEntry->id);
					$c->setDate($gooddate);
				}
			}
		}
开发者ID:niczak,项目名称:TweetPHP,代码行数:29,代码来源:YouTubeData.class.php


示例3: searchAndPrint

function searchAndPrint($searchTerms = 'sesame street')
{
    $yt = new Zend_Gdata_YouTube();
    $yt->setMajorProtocolVersion(2);
    $query = $yt->newVideoQuery();
    $query->setOrderBy('relevance');
    $query->setSafeSearch('moderate');
    $query->setVideoQuery($searchTerms);
    $query->setParam('caption', 'true');
    $query->setParam('start-index', $_GET['start_index']);
    $query->setParam('max-results', 8);
    //$query->setParam('max-results','2');
    // Note that we need to pass the version number to the query URL function
    // to ensure backward compatibility with version 1 of the API.
    //echo $query->getQueryUrl(2);
    //$videoFeed = $yt->getVideoFeed("http://gdata.youtube.com/feeds/api/videos?orderby=relevance&safeSearch=moderate&q=sesame+street");
    $videoFeed = $yt->getVideoFeed($query->getQueryUrl(2));
    $links = $videoFeed->getLink();
    $suggestFlag = null;
    foreach ($links as $link) {
        if ($link->getRel() == 'http://schemas.google.com/g/2006#spellcorrection') {
            $videoFeed = $yt->getVideoFeed($link->getHref());
            //print_r($link->getTitle());
            $suggestFlag = $link->getTitle();
            break;
        }
    }
    //if($links[1]){
    //}
    printVideoFeed($videoFeed, $suggestFlag);
    //'Search results for: ' . $searchTerms);
}
开发者ID:nadu,项目名称:open-captions,代码行数:32,代码来源:search.php


示例4: getLastVideos

 public function getLastVideos($limit = 5)
 {
     $ytUser = $this->_usr;
     $array = array();
     try {
         $gdata = new Zend_Gdata_YouTube();
         $feed = $gdata->getUserUploads($ytUser);
         if ($feed) {
             $i = 1;
             foreach ($feed as $entry) {
                 $thumb = max($entry->getVideoThumbnails());
                 $image = min($entry->getVideoThumbnails());
                 $date = new Zend_Date($entry->getVideoDuration(), Zend_Date::SECOND);
                 $array[] = array("id" => $entry->getVideoId(), "title" => $entry->getVideoTitle(), "thumb" => $thumb["url"], "time" => $date->get("mm:ss"), "image" => $image["url"]);
                 if ($i == $limit) {
                     break;
                     /* Sai */
                 }
                 $i++;
             }
         }
     } catch (Zend_Exception $e) {
     }
     return $array;
 }
开发者ID:alissonpirola,项目名称:site-drandre,代码行数:25,代码来源:Video.php


示例5: getAndPrintVideoFeed

function getAndPrintVideoFeed($location = Zend_Gdata_YouTube::VIDEO_URI)
{
    $yt = new Zend_Gdata_YouTube();
    // set the version to 2 to receive a version 2 feed of entries
    $yt->setMajorProtocolVersion(2);
    $videoFeed = $yt->getVideoFeed($location);
    printVideoFeed($videoFeed);
}
开发者ID:aboynejames,项目名称:phplifestylelinking,代码行数:8,代码来源:youtubedaily.php


示例6: moveVideo

 /**
  * YT API KEY: AI39si53nkZgrhA-nJLOurfN5yOdLdQeWHK_M08w1A19kfwa718lRXR8Dilcpnc1D0BVXn8KLAfSyYdYbdrd3X7bgDV0ma59Zg
  */
 public function moveVideo($video)
 {
     ProjectConfiguration::registerZend();
     $httpClient = Zend_Gdata_ClientLogin::getHttpClient('[email protected]', 'watchm3now', 'youtube', null, 'lifeimpact', null, null, 'https://www.google.com/accounts/ClientLogin');
     $applicationId = 'lifeimpact';
     $clientId = 'lifeimpact';
     $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, YOUTUBE_DEVELOPER_KEY);
     $yt->setMajorProtocolVersion(2);
 }
开发者ID:hashir,项目名称:UoA,代码行数:12,代码来源:actions.class.php


示例7: acceptAllContacts

 function acceptAllContacts($userName)
 {
     $yt = new Zend_Gdata_YouTube();
     $contactsFeed = $yt->getContactFeed($userName);
     foreach ($contactsFeed as $contactsEntry) {
         $contactEntry->setStatus($yt->newStatus('accepted'));
         $contactEntry->save();
     }
 }
开发者ID:laiello,项目名称:we-promote-this,代码行数:9,代码来源:YoutubeVideoResponseMatrix.php


示例8: module_last_youtube_playlist_videos

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_last_youtube_playlist_videos($mod_reference, $module_params)
{
    global $smarty, $prefs;
    $tikilib = TikiLib::lib('tiki');
    $data = array();
    if (!empty($module_params['id'])) {
        $id = $module_params['id'];
        require_once 'lib/wiki-plugins/wikiplugin_youtube.php';
        if (!empty($module_params['orderby'])) {
            $orderby = $module_params['orderby'];
            $feedUrl = 'http://gdata.youtube.com/feeds/api/playlists/' . $id . '?orderby=' . $orderby;
        } else {
            $feedUrl = 'http://gdata.youtube.com/feeds/api/playlists/' . $id . '?orderby=position';
        }
        $yt = new Zend_Gdata_YouTube();
        $yt->setMajorProtocolVersion(2);
        $yt->setHttpClient($tikilib->get_http_client());
        try {
            $playlistVideoFeed = $yt->getPlaylistVideoFeed($feedUrl);
            $data[$id]['info']['title'] = $playlistVideoFeed->title->text;
            // Prepare params for video display
            $params = array();
            $params['width'] = isset($module_params['width']) ? $module_params['width'] : 425;
            $params['height'] = isset($module_params['height']) ? $module_params['height'] : 350;
            // Get information from all videos from playlist
            // Limit to $module_rows first videos if $module_rows is set
            $count_videos = 1;
            foreach ($playlistVideoFeed as $videoEntry) {
                $videoId = $videoEntry->getVideoId();
                $data[$id]['videos'][$videoId]['title'] = $videoEntry->getVideoTitle();
                $data[$id]['videos'][$videoId]['uploaded'] = $videoEntry->mediaGroup->uploaded->text;
                $data[$id]['videos'][$videoId]['description'] = $videoEntry->getVideoDescription();
                $params['movie'] = $videoId;
                $pluginstr = wikiplugin_youtube('', $params);
                $len = strlen($pluginstr);
                //need to take off the ~np~ and ~/np~ at the beginning and end of the string returned by wikiplugin_youtube
                $data[$id]['videos'][$videoId]['xhtml'] = substr($pluginstr, 4, $len - 4 - 5);
                if (isset($module_rows) && $module_rows > 0 && $count_videos >= $module_rows) {
                    break;
                }
                $count_videos++;
            }
        } catch (Exception $e) {
            $data[$id]['info']['title'] = tra('No Playlist found');
            $data[$id]['videos'][0]['title'] = $e->getMessage();
        }
    } else {
        $id = 0;
        $data[$id]['info']['title'] = tra('No Playlist found');
        $data[$id]['videos'][0]['title'] = tra('No Playlist ID was provided');
    }
    $smarty->assign('verbose', isset($module_params['verbose']) ? $module_params['verbose'] : 'y');
    $smarty->assign('link_url', isset($module_params['link_url']) ? $module_params['link_url'] : '');
    $smarty->assign('link_text', isset($module_params['link_text']) ? $module_params['link_text'] : 'More Videos');
    $smarty->assign_by_ref('data', $data[$id]);
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:60,代码来源:mod-func-last_youtube_playlist_videos.php


示例9: testSetClientIDAndDeveloperKeyHeader

 public function testSetClientIDAndDeveloperKeyHeader()
 {
     $applicationId = 'MyTestCompany-MyTestApp-0.1';
     $clientId = 'MyClientId';
     $developerKey = 'MyDeveloperKey';
     $httpClient = new Zend_Http_Client();
     $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
     $this->assertTrue($yt instanceof Zend_Gdata_YouTube);
     $client = $yt->getHttpClient();
     $this->assertEquals($client->getHeader('X-Gdata-Key'), 'key=' . $developerKey);
     $this->assertEquals($client->getHeader('X-Gdata-Client'), $clientId);
 }
开发者ID:robertfoleyjr,项目名称:robertfoleyjr-d6,代码行数:12,代码来源:YouTubeTest.php


示例10: getYtVideos

 public function getYtVideos()
 {
     $converted_values = array();
     $gdata = new Zend_Gdata_YouTube();
     $feed = $gdata->getUserUploads($this->_config->getConfiguracao(CFG_YOUTUBE));
     foreach ($feed as $entry) {
         /* @var $entry Zend_Gdata_YouTube_VideoEntry */
         $thumbnail = $entry->getVideoThumbnails();
         $date = new Zend_Date($entry->getPublished());
         $converted_values[$entry->getVideoId()] = array('video_id' => $entry->getVideoId(), 'nm_title' => $entry->getVideoTitle(), 'tx_description' => $entry->getVideoDescription(), 'thumbnail_small' => $thumbnail[0]['url'], 'thumbnail_big' => $thumbnail[2]['url'], 'nu_time' => $entry->getVideoDuration(), 'dt_upload' => $date->get('yyyy-MM-dd'));
     }
     return $converted_values;
 }
开发者ID:alissonpirola,项目名称:site-drandre,代码行数:13,代码来源:VideoController.php


示例11: delete

 function delete($username, $password, $source, $videoId)
 {
     $httpClient = $this->clientLogin($username, $password, $source);
     $httpClient->setHeaders('X-GData-Key', "key={$source}");
     $yt = new Zend_Gdata_YouTube($httpClient);
     try {
         $videoEntryToDelete = $yt->getVideoEntry($videoId, null, true);
         $result = $yt->delete($videoEntryToDelete);
         return $result;
     } catch (Zend_Gdata_App_HttpException $httpException) {
         echo $httpException->getRawResponseBody();
     } catch (Zend_Gdata_App_Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:hoanglannet,项目名称:copar,代码行数:15,代码来源:zendyoutube.php


示例12: get_PlaylistEntry_from_Id

 /**
  *
  * @param  string                              $element_id
  * @return Zend_Gdata_YouTube_PlaylistListFeed
  */
 protected function get_PlaylistEntry_from_Id($element_id)
 {
     foreach ($this->_api->getPlaylistListFeed('default') as $playlist_entry) {
         if ($element_id == $playlist_entry->getPlaylistId()->getText()) {
             return $playlist_entry;
         }
     }
     return null;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:14,代码来源:Youtube.php


示例13: upload

 public static function upload($asset)
 {
     try {
         $credentials = Asset_Video_Youtube::getYoutubeCredentials();
         if (!$credentials) {
             return;
         }
         $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username = $credentials["username"], $password = $credentials["password"], $service = 'youtube', $client = Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient"), $source = 'Pimcore', $loginToken = null, $loginCaptcha = null, 'https://www.google.com/youtube/accounts/ClientLogin');
         $httpClient->setConfig(array("timeout" => 3600));
         $apikey = $credentials["apiKey"];
         $httpClient->setHeaders('X-GData-Key', "key={$apikey}");
         $yt = new Zend_Gdata_YouTube($httpClient);
         $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
         $filesource = $yt->newMediaFileSource($asset->getFileSystemPath());
         $filesource->setContentType($asset->getMimetype());
         $filesource->setSlug($asset->getFilename());
         $myVideoEntry->setMediaSource($filesource);
         $myVideoEntry->setVideoTitle($asset->getFullPath());
         $myVideoEntry->setVideoDescription($asset->getFullPath());
         $myVideoEntry->setVideoCategory('Comedy');
         // Set keywords, note that this must be a comma separated string
         // and that each keyword cannot contain whitespace
         $myVideoEntry->SetVideoTags('---, ---');
         // Optionally set some developer tags
         $myVideoEntry->setVideoDeveloperTags(array('mydevelopertag', 'anotherdevelopertag'));
         // Upload URI for the currently authenticated user
         $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/users/default/uploads';
         try {
             $newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
             $asset->setCustomSetting("youtube", array("id" => strval($newEntry->getVideoId())));
             $asset->save();
             return true;
         } catch (Exception $e) {
             $asset->setCustomSetting("youtube", array("failed" => true));
             $asset->save();
         }
     } catch (Exception $e) {
         Logger::error($e);
     }
     return false;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:41,代码来源:Youtube.php


示例14: youtubeEntry

 function youtubeEntry()
 {
     ini_set("display_errors", 0);
     /**
      * credentials
      */
     define('EMAIL_ID', '[email protected]');
     define('EMAIL_PASS', 'uoatest@7');
     define('YOUTUBE_DEVELOPER_KEY', 'AI39si4DVYjRr1KL17gdDJwosRs4eUblWKBKB7rbqV90Ku1jDye7rVjXbZ_2KaZGiqcDeJBhDYgIzFjczF2FQBUslV27bMeJ9Q');
     require_once 'lib/vendor/Zend/Loader.php';
     Zend_Loader::loadClass('Zend_Gdata_YouTube');
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
     $httpClient = Zend_Gdata_ClientLogin::getHttpClient(EMAIL_ID, EMAIL_PASS, 'youtube', null, 'UoAyoutube', null, null, 'https://www.google.com/accounts/ClientLogin');
     $applicationId = 'Video uploader v1';
     $clientId = 'My video upload client - v1';
     $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, YOUTUBE_DEVELOPER_KEY);
     $yt->setMajorProtocolVersion(2);
     //$videoFeed = $yt->getVideoFeed(Zend_Gdata_YouTube::VIDEO_URI);
     $videoFeed = $yt->getuserUploads("uoatest7");
     $this->printVideo($videoFeed);
 }
开发者ID:hashir,项目名称:UoA,代码行数:21,代码来源:entriesTask.class.php


示例15: getFromYoutube

 /**
  * get a new video from from a youtube url
  *
  * @param $url
  * @return Model_Video video object
  */
 public function getFromYoutube($url)
 {
     $urlArray = parse_url($url);
     if (!isset($urlArray['query'])) {
         throw new Exception('Invalid URL');
     }
     parse_str($urlArray['query'], $query);
     if (!isset($query['v'])) {
         throw new Exception('Invalide YouTube Video URL');
     }
     $youtube_id = $query['v'];
     $yt = new Zend_Gdata_YouTube();
     try {
         $videoEntry = $yt->getVideoEntry($youtube_id);
     } catch (Zend_Gdata_App_HttpException $e) {
         //YouTube may be down too?
         throw new Exception('Invalid YouTube Video URL');
     }
     $data = array('url' => $url, 'youtube_id' => $youtube_id, 'title' => $videoEntry->getTitleValue());
     return new Model_Video($data);
 }
开发者ID:eleclerc,项目名称:subyt,代码行数:27,代码来源:VideoMapper.php


示例16: doYoutubeUpload

 public function doYoutubeUpload($options = array('title' => '', 'titleAlias' => '', 'introText' => '', 'source' => '', 'tags' => '', 'description' => ''))
 {
     $this->fileVideoName = $this->upload->getUploadName();
     $title = $options['title'];
     $titleAlias = $options['titleAlias'];
     $introText = $options['introText'];
     $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
     $fileName = $this->fileVideoName;
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
     $httpclient = Zend_Gdata_ClientLogin::getHttpClient($this->username, $this->password, $service = 'youtube', $client = null, $source = $options['source'], $loginToken = null, $loginCaptcha = null, $this->authenticationURL);
     Zend_Loader::loadClass('Zend_Gdata_YouTube');
     $yt = new Zend_Gdata_YouTube($httpclient, $options['name'], $options['name'], $this->developerKey);
     $videoEntry = new Zend_Gdata_YouTube_VideoEntry();
     $filesource = $yt->newMediaFileSource($fileName);
     $filesource->setContentType('video/' . $this->upload->fileExt);
     $filesource->setSlug($fileName);
     $videoEntry->setMediaSource($filesource);
     $videoEntry->setVideoTitle($title);
     $videoEntry->setVideoDescription($options['description']);
     $videoEntry->setVideoCategory($options['category']);
     $videoEntry->SetVideoTags($options['tags']);
     try {
         $videoEntry = $yt->insertEntry($videoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
         $state = $videoEntry->getVideoState();
         if ($state) {
             $youtubeId = $videoEntry->getVideoId();
             $this->videoId = $youtubeId;
             $this->videoUrl = "http://youtu.be/{$youtubeId}";
             $this->thumbSrc = "http://img.youtube.com/vi/{$youtubeId}/default.jpg";
             $this->duration = $this->length = 0;
             $this->parseAdditionalMetadata();
         } else {
             throw new Exception("Not able to retrieve the video status information yet. " . "Please try again later.\n");
         }
     } catch (Zend_Gdata_App_HttpException $httpException) {
         throw new Exception($httpException->getRawResponseBody());
     } catch (Zend_Gdata_App_Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:holdensmagicalunicorn,项目名称:copperFramework,代码行数:40,代码来源:copperYoutubeUpload.php


示例17: getVideos

 /**
  * Retrieve user's uploaded videos.
  *
  * @param $maxResults int
  *       	 Maximum number of YoutubeVideo to return.
  * @return array(YoutubeVideo) Videos retrieved.
  */
 public function getVideos($maxResults)
 {
     try {
         set_include_path(get_include_path() . PATH_SEPARATOR . dirname(WSW_Main::$plugin_dir) . '/lib/Youtube');
         if (!class_exists('Zend_Loader')) {
             require_once 'Zend/Loader.php';
         }
         Zend_Loader::loadClass('Zend_Gdata_Query');
         Zend_Loader::loadClass('Zend_Gdata_YouTube');
         // If the keyword is compoused, divide each word
         $key_phrase = $this->keyword;
         $key_phrase_arr = explode(' ', $key_phrase);
         $query_url = Zend_Gdata_YouTube::VIDEO_URI . "/-/";
         foreach ($key_phrase_arr as $key_phrase_item) {
             if (trim($key_phrase_item) != '') {
                 $query_url .= trim($key_phrase_item) . '/';
             }
         }
         //$query_url .= '?v=2';
         $query = new Zend_Gdata_Query($query_url);
         $query->setMaxResults($maxResults);
         $query->setParam('orderby', 'viewCount');
         $yt = new Zend_Gdata_YouTube();
         $yt->setMajorProtocolVersion(2);
         $videoFeed = $yt->getFeed($query, 'Zend_Gdata_YouTube_VideoFeed');
         // TODO See how this initialization must be done, I mean if is really neccesary
         $keyVideos = array();
         foreach ($videoFeed as $videoEntry) {
             $keyVideos[] = new WSW_YoutubeVideo($videoEntry);
         }
         return $keyVideos;
     } catch (Exception $e) {
         // Store to log
         $msg_to_log = 'Error while getVideos from Youtube, Url: ' . $query_url . ', Exception Msg: ' . $e->getMessage();
         return array();
     }
 }
开发者ID:Kishor900,项目名称:scrapboard,代码行数:44,代码来源:YoutubeInterface.php


示例18: video

 function video()
 {
     $videoId = $this->params['id'];
     $yt = new Zend_Gdata_YouTube();
     $entry = $yt->getVideoEntry($videoId);
     $this->set('videoTitle', $entry->mediaGroup->title);
     $this->set('description', $entry->mediaGroup->description);
     $this->set('authorUsername', $entry->author[0]->name);
     $this->set('authorUrl', 'http://www.youtube.com/profile?user=' . $entry->author[0]->name);
     $this->set('tags', $entry->mediaGroup->keywords);
     $this->set('duration', $entry->mediaGroup->duration->seconds);
     $this->set('watchPage', $entry->mediaGroup->player[0]->url);
     $this->set('viewCount', $entry->statistics->viewCount);
     $this->set('rating', $entry->rating->average);
     $this->set('numRaters', $entry->rating->numRaters);
     /* Get related Videos */
     $ytQuery = $yt->newVideoQuery();
     $ytQuery->setFeedType('related', $videoId);
     $ytQuery->setOrderBy('rating');
     $ytQuery->setMaxResults(5);
     $ytQuery->setFormat(5);
     $this->set('videoId', $videoId);
     $this->set('related', $yt->getVideoFeed($ytQuery));
 }
开发者ID:simonescu,项目名称:mashupkeyword,代码行数:24,代码来源:youtube_controller.php


示例19: populateFromUrl

 public function populateFromUrl()
 {
     $urlArray = parse_url($this->getUrl());
     if (!isset($urlArray['query'])) {
         throw new Exception('Invalid URL');
     }
     parse_str($urlArray['query'], $query);
     if (!isset($query['v'])) {
         throw new Exception('Invalide YouTube Video URL');
     }
     $youtube_id = $query['v'];
     $yt = new Zend_Gdata_YouTube();
     try {
         $videoEntry = $yt->getVideoEntry($youtube_id);
     } catch (Zend_Gdata_App_HttpException $e) {
         //YouTube may be down too?
         throw new Exception('Invalid YouTube Video URL');
     }
     $this->youtube_id = $youtube_id;
     $this->youtube_title = $videoEntry->getVideoTitle();
     $this->youtube_description = $videoEntry->getVideoDescription();
     $thumbnails = $videoEntry->getVideoThumbnails();
     $this->youtube_thumbnail = $thumbnails[0]['url'];
 }
开发者ID:eleclerc,项目名称:subyt_symfony1,代码行数:24,代码来源:Video.class.php


示例20: actionFormData

 /**
  * Prints a JSON with URL for form action and the needed token, and dies.<br />
  * Used with JSON POST requests.<br />
  * <p>Asks for the following POST fields:
  * <ul>
  *		<li>title</li>
  *		<li>description</li>
  *		<li>category (only one)</li>
  *		<li>keywords (comma-separated)</li>
  * </ul>
  * </p>
  * @return JSON
  */
 public function actionFormData()
 {
     Yii::import('system.collections.*');
     Yii::import('system.base.*');
     Yii::import('ext.*');
     Yii::import('ext.Zend.Gdata.*');
     require_once 'Zend/Loader.php';
     Yii::registerAutoloader(array('Zend_Loader', 'loadClass'));
     $login = Zend_Gdata_ClientLogin::getHttpClient($this->youtubeLogin, $this->youtubePassword, 'youtube', null, Yii::app()->name);
     $login->setHeaders('X-GData-Key', 'key=' . $this->youtubeDevKey);
     $utub = new Zend_Gdata_YouTube($login);
     $video = new Zend_Gdata_YouTube_VideoEntry();
     $media = $utub->newMediaGroup();
     $media->title = $utub->newMediaTitle()->setText($_POST['title']);
     $media->description = $utub->newMediaDescription()->setText($_POST['description']);
     $media->keywords = $utub->newMediaKeywords()->setText($_POST['keywords']);
     $media->category = array($utub->newMediaCategory()->setText($_POST['category'])->setScheme(self::CAT_SCHEME), $utub->newMediaCategory()->setText(preg_replace('/\\s/', '', Yii::app()->name) . 'Site')->setScheme(self::TAG_SCHEME));
     $video->mediaGroup = $media;
     $data = $utub->getFormUploadToken($video);
     exit(json_encode($data));
 }
开发者ID:nurirahmat,项目名称:Yii-Extensions,代码行数:34,代码来源:YouTubeUploader.php



注:本文中的Zend_Gdata_YouTube类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Gdata_YouTube_Extension_Description类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Gdata_Spreadsheets_ListQuery类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap