本文整理汇总了PHP中Zend_Gdata_YouTube::getVideoEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube::getVideoEntry方法的具体用法?PHP Zend_Gdata_YouTube::getVideoEntry怎么用?PHP Zend_Gdata_YouTube::getVideoEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_YouTube
的用法示例。
在下文中一共展示了Zend_Gdata_YouTube::getVideoEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_element_from_id
/**
*
* @param string $element_id
* @param string $object
*
* @return Bridge_Api_Youtube_Element
*/
public function get_element_from_id($element_id, $object)
{
switch ($object) {
case self::ELEMENT_TYPE_VIDEO:
return new Bridge_Api_Youtube_Element($this->_api->getVideoEntry($element_id), $object);
break;
default:
throw new Bridge_Exception_ElementUnknown('Unknown element ' . $object);
break;
}
}
示例2: echoVideoPlayer
function echoVideoPlayer($videoId)
{
$yt = new Zend_Gdata_YouTube();
$entry = $yt->getVideoEntry($videoId);
$videoTitle = $entry->mediaGroup->title->text;
$videoUrl = findFlashUrl($entry);
//$relatedVideoFeed = getRelatedVideos($entry->getVideoId());
//$topRatedFeed = getTopRatedVideosByUser($entry->author[0]->name);
$list = array('title' => $entry->mediaGroup->title->text, 'description' => $entry->mediaGroup->description->text, 'author' => (string) $entry->author[0]->name, 'authorUrl' => 'http://www.youtube.com/profile?user=' . $entry->author[0]->name, 'tags' => (string) $entry->mediaGroup->keywords, 'duration' => $entry->mediaGroup->duration->seconds, 'watchPage' => $entry->mediaGroup->player[0]->url, 'viewCount' => $entry->statistics->viewCount, 'rating' => $entry->rating->average, 'numRaters' => $entry->rating->numRaters, 'videoUrl' => findFlashUrl($entry));
return $list;
}
示例3: 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();
}
}
示例4: 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);
}
示例5: 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'];
}
示例6: 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));
}
示例7: echoVideoPlayer
/**
* Echo the video embed code, related videos and videos owned by the same user
* as the specified videoId.
*
* @param string $videoId The video
* @return void
*/
function echoVideoPlayer($videoId)
{
$youTubeService = new Zend_Gdata_YouTube();
try {
$entry = $youTubeService->getVideoEntry($videoId);
} catch (Zend_Gdata_App_HttpException $httpException) {
print 'ERROR ' . $httpException->getMessage() . ' HTTP details<br /><textarea cols="100" rows="20">' . $httpException->getRawResponseBody() . '</textarea><br />' . '<a href="session_details.php">' . 'click here to view details of last request</a><br />';
return;
}
$videoTitle = htmlspecialchars($entry->getVideoTitle());
$videoUrl = htmlspecialchars(findFlashUrl($entry));
$relatedVideoFeed = getRelatedVideos($entry->getVideoId());
$topRatedFeed = getTopRatedVideosByUser($entry->author[0]->name);
print <<<END
<b>{$videoTitle}</b><br />
<object width="425" height="350">
<param name="movie" value="{$videoUrl}&autoplay=1"></param>
<param name="wmode" value="transparent"></param>
<embed src="{$videoUrl}&autoplay=1" type="application/x-shockwave-flash" wmode="transparent"
width="425" height="350"></embed>
</object>
END;
echo '<br />';
echoVideoMetadata($entry);
echo '<br /><b>Related:</b><br />';
echoThumbnails($relatedVideoFeed);
echo '<br /><b>Top rated videos by user:</b><br />';
echoThumbnails($topRatedFeed);
}
示例8: getVideo
/**
* Функция получения видео-файла
* @param $videoId
*/
public function getVideo($videoId)
{
$yt = new Zend_Gdata_YouTube($this->authYT($username, $password));
$videoEntry = $yt->getVideoEntry($videoId);
$resArr = $this->getVideoInfo($videoEntry);
return $resArr;
}
示例9: actualizar
//.........这里部分代码省略.........
$data['post_content'] = "<p>" . $this->input->post('texto') . "</p>";
$data['tags'] = $this->input->post('tags');
$this->load->library('zend');
$this->zend->load('Zend/Gdata/YouTube');
$this->zend->load('Zend/Gdata/ClientLogin');
$authenticationURL = 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($username = 'alvaropereyra.storage1@gmail.com', $password = 'vossosalvarox', $service = 'youtube', $client = null, $source = 'LaMulaSRD', $loginToken = null, $loginCaptcha = null, $authenticationURL);
$clientId = "ytapi-AlvaroPereyraRab-WebPublishing-afg0bc0f-0";
$developerKey = "AI39si77SKdfoJ3spb7HZHe_tUVcOKX_TAn7Fne7BU8ux6ixJ6E8ZdNmZ7UeJs7y3ZGOfVyNAzSe4nYJqIX3Lu7RNryf-dOn9A";
$httpClient->setHeaders('X-GData-Key', "key={$developerKey}");
$applicationId = "SRD-LaMula-1.0";
$yt = new Zend_Gdata_YouTube($httpClient);
switch ($this->input->post('upload-content')) {
//subir documentos
case 'subir':
if ($this->_is_ie6() == TRUE or $ie != null) {
if ($_FILES['Filedata']['error'] == 0) {
$aceptados = array('video/quicktime', 'video/mpeg');
if (in_array($_FILES['Filedata']['type'], $aceptados)) {
$docs_id[] = $this->_upload($ie);
if (is_null($docs_id[0])) {
//error y debo redireccionar
$this->load->library('session');
$this->session->set_flashdata('fileupload', 'Error en la carga');
redirect('videos/formulario');
}
} else {
$this->load->library('session');
$this->session->set_flashdata('fileupload', 'Error en la carga');
redirect('videos/formulario');
}
}
} else {
$docs_id = split('-', $this->input->post('files'));
unset($docs_id[0]);
}
foreach ($docs_id as $doc) {
$youtube = substr($doc, 31);
$videoEntry = $yt->getVideoEntry($youtube);
$videoThumbnails = $videoEntry->getVideoThumbnails();
$photo_url = $videoThumbnails[0]["url"];
$tmp = '<img rel="from_video" class="alignnone fromvideo" src="' . $photo_url . '" />';
$tmp .= '<br />';
$tmp .= "[youtube]";
$tmp .= $doc;
$tmp .= '[/youtube]';
$data['post_content'] = $tmp . $data['post_content'];
}
break;
//enlazar
//enlazar
case 'enlazar':
$url = $this->input->post('doclink');
$youtube = substr($url, 31);
$videoEntry = $yt->getVideoEntry($youtube);
$videoThumbnails = $videoEntry->getVideoThumbnails();
$photo_url = $videoThumbnails[0]["url"];
$tmp = '<img rel="from_video" class="alignnone fromvideo" src="' . $photo_url . '" />';
$tmp .= '[youtube]' . $url . '[/youtube]';
$tmp .= '<br />';
$data['post_content'] .= $tmp;
break;
}
//$data['post_content'] = $data['post_content'];
//consigue los id de las cata
$this->load->library('combofiller');
$categorias = $this->combofiller->categorias();
$terms_taxonomy_id = NULL;
foreach ($categorias as $key => $value) {
if ($this->input->post('' . $key . '')) {
$terms_taxonomy_id[] = $key;
}
}
switch ($this->input->post('localizar')) {
case 'mundo':
$tmp = array('pais');
break;
case 'peru':
$tmp = array('provincia', 'distrito', 'departamento');
break;
}
foreach ($tmp as $custom) {
if ($this->input->post($custom) != NULL) {
$customs[$custom] = sanitize2url($this->input->post($custom));
}
}
$data['terms_taxonomy_id'] = $terms_taxonomy_id;
if ($id == NULL) {
$post_id = $this->post->insert_article($data, $customs);
$this->term_relationships->insertar($post_id, array(32));
} else {
$where['id'] = $id;
$this->post->actualizar($data, $customs, $where);
$this->session->set_flashdata('notice', 'Documento actualizado exitosamente');
redirect('home/dashboard');
}
$this->session->set_flashdata('notice', 'Video enviado exitosamente');
redirect('home/dashboard');
}
}
示例10: comment
function comment($entry, $comment)
{
$username = $_SESSION['username'];
$query = "select token from user where username='{$username}'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$token = $row['token'];
$httpClient = Zend_Gdata_AuthSub::getHttpClient($token);
$developerKey = 'AI39si5uCFW5FETweIaPnbNJUP88YvpOtSoy7FSUnYnTFVH4liFKzqWTkndATtgiltByN54tPcVjsScyh3S28P-D4PC4n73alg';
$applicationId = 'EazySubs';
$clientId = 'EazySubs';
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
try {
$videoEntry = $yt->getVideoEntry($entry);
$newComment = $yt->newCommentEntry();
$newComment->content = $yt->newContent()->setText($comment);
// post the comment to the comments feed URL for the video
$commentFeedPostUrl = $videoEntry->getVideoCommentFeedUrl();
$updatedVideoEntry = $yt->insertEntry($newComment, $commentFeedPostUrl, 'Zend_Gdata_YouTube_CommentEntry');
return true;
} catch (Exception $e) {
return false;
}
}
示例11: displayRemoveVideoSubmit
/**
* displayRemoveVideoSubmit
*
* Remove video doesn't actually physically delete the video from FCMS, it
* just sets the video to in-active in the DB, which removes it from view.
*
* We don't want to delete these entries from the db, because the cron importer
* will just continue to import them.
*
* @return void
*/
function displayRemoveVideoSubmit()
{
if (!isset($_POST['id']) || !isset($_POST['source_id'])) {
$this->displayHeader();
echo '<div class="error_alert">' . T_('Can\'t remove video. Missing video id.') . '</div>';
$this->displayFooter();
return;
}
$userId = (int) $_GET['u'];
$id = (int) $_POST['id'];
$sourceId = $_POST['source_id'];
$sql = "UPDATE `fcms_video`\n SET `active` = 0,\n `updated` = NOW(),\n `updated_id` = ?\n WHERE `id` = ?";
if (!$this->fcmsDatabase->update($sql, array($this->fcmsUser->id, $id))) {
$this->displayFooter();
$this->fcmsError->displayError();
$this->displayFooter();
return;
}
if (isset($_POST['delete_youtube'])) {
$sessionToken = $this->getSessionToken($this->fcmsUser->id);
$youtubeConfig = getYouTubeConfigData();
$httpClient = getYouTubeAuthSubHttpClient($youtubeConfig['youtube_key'], $sessionToken);
if ($httpClient === false) {
// Error message was already displayed by getYouTubeAuthSubHttpClient()
$this->displayFooter();
return;
}
$youTubeService = new Zend_Gdata_YouTube($httpClient);
$videoEntry = $youTubeService->getVideoEntry($sourceId);
// Set message
$_SESSION['message'] = 'delete_video_youtube';
$youTubeService->delete($videoEntry);
}
// Set message
if (!isset($_SESSION['message'])) {
$_SESSION['message'] = 'remove_video';
}
// Send back to user's video listing
header("Location: video.php?u={$userId}");
}
示例12: handleInformation
public function handleInformation($type, $code)
{
switch ($type) {
//youtube
case "1":
$yt = new Zend_Gdata_YouTube();
$youtube_video = $yt->getVideoEntry($code);
$information = array();
$information['title'] = $youtube_video->getTitle();
$information['description'] = $youtube_video->getVideoDescription();
$information['duration'] = $youtube_video->getVideoDuration();
//http://img.youtube.com/vi/Y75eFjjgAEc/default.jpg
return $information;
//vimeo
//vimeo
case "2":
//thumbnail_medium
$data = simplexml_load_file("http://vimeo.com/api/v2/video/" . $code . ".xml");
$thumbnail = $data->video->thumbnail_medium;
$information = array();
$information['title'] = $data->video->title;
$information['description'] = $data->video->description;
$information['duration'] = $data->video->duration;
//http://img.youtube.com/vi/Y75eFjjgAEc/default.jpg
return $information;
}
}
示例13: player_shortcode
function player_shortcode($atts)
{
$username = get_option('youtube_user');
//gets the username that was entered in the admin screen
//declares the attributes for the video player shortcode
$atts = shortcode_atts(array('width' => '450', 'height' => '253', 'videocode' => '', 'description' => 'yes', 'title' => 'yes', 'descriptionlength' => '1000', 'classname' => ''), $atts);
global $descriptionlength;
//makes $descriptionlength a global variable so the right length descriptions can be passed from the feed function
$descriptionlength = $atts['descriptionlength'];
//assigns $descriptionlength the desired value.
//YouTube classes for Gdata
$yt = new Zend_Gdata_YouTube();
$yt->setMajorProtocolVersion(2);
//if there is a defined video to display on page load, load that video.
if ($atts['videocode'] != '') {
$videoEntry = $yt->getVideoEntry($atts['videocode']);
//get Gdata for all the desired video
$descriptionlong = $videoEntry->getVideoDescription();
$description = substr($descriptionlong, 0, $atts['descriptionlength']) . "...";
//description set to the desired length
//print HTML for the video player
$videoplayer = '<div id="playerchart" class="' . $atts['classname'] . '" >';
if ($atts['title'] == 'yes' || $atts['title'] == 'true') {
$videoplayer = $videoplayer . '<div id="titlediv" ><b class="title_player" id="title_player">' . $titleplayer . '</b></div>';
}
$videoplayer = $videoplayer . '<div class="video_player"><iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" id="playingvideo" src="http://www.youtube.com/embed/' . $atts['videocode'] . '" frameborder="0" allowfullscreen></iframe></div>';
if ($atts['description'] == 'yes' || $atts['description'] == 'true') {
$videoplayer = $videoplayer . '<div class="player_description" id="player_description">' . $description . '</div>';
}
$videoplayer = $videoplayer . '</div>';
return $videoplayer;
goto a;
//skip out the rest of the function
} else {
$url = 'http://gdata.youtube.com/feeds/api/users/' . $username . '/uploads?orderby=viewCount&max-results=1';
//url for video feed of one video
}
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$videoFeed = @$yt->getVideoFeed($url);
//create feed from URL
//loop through feed
foreach ($videoFeed as $videoEntry) {
$descriptionlong = $videoEntry->getVideoDescription();
//get video description
$titleplayer = $videoEntry->getVideoTitle();
//get video title
//change video length if longer than desired amount
if (strlen($descriptionlong) > $atts['descriptionlength']) {
$descriptionlong = $videoEntry->getVideoDescription();
$description = substr($descriptionlong, 0, $atts['descriptionlength']) . "...";
//... to the end of cut description
} else {
$description = $videoEntry->getVideoDescription();
//if description is shorter than maximum amount assign full description
}
//print video player from feed data
$videoplayer = '<div id="playerchart" class="' . $atts['classname'] . '" >';
$videoplayer = $videoplayer . '<div id="titlediv" ><b id="title_player">' . $titleplayer . '</b></div>';
$videoplayer = $videoplayer . '<div style="margin-right:20px;"><iframe width="450" height="253" id="playingvideo" src="http://www.youtube.com/embed/' . $videoEntry->getVideoId() . '" frameborder="0" allowfullscreen></iframe></div>';
$videoplayer = $videoplayer . '<div id="player_description">' . $description . '</div>';
$videoplayer = $videoplayer . '</div>';
return $videoplayer;
break;
//end the loop after one cycle to make sure only one player appears.
}
a:
//where the process skips to if specific video is defined for page load.
}
示例14: getselectedvideoAction
/**
* getselectedvideoAction
* @author Dominik Mößlang <dmo@massiveart.com>
* @version 1.0
*/
public function getselectedvideoAction()
{
$this->core->logger->debug('core->controllers->VideoController->getselectedvideoAction()');
$strVideoTypeName = '';
$intVideoTypeId = '';
$objSelectedVideo = '';
try {
$objRequest = $this->getRequest();
$intChannelId = $objRequest->getParam('channelId');
$strElementId = $objRequest->getParam('elementId');
$strValue = $objRequest->getParam('value');
$strChannelUserId = $objRequest->getParam('channelUserId');
$arrSelectedVideo = array();
switch ($intChannelId) {
/**
* Vimeo Controller
*/
case $this->core->sysConfig->video_channels->vimeo->id:
require_once GLOBAL_ROOT_PATH . 'library/vimeo/vimeo.class.php';
$intVideoTypeId = 1;
$strVideoTypeName = "Vimeo";
/**
* Get the selected Video
*/
if (isset($strValue)) {
$objResponse = VimeoVideosRequest::getInfo($strValue);
$objSelectedVideo = $objResponse->getVideo();
}
break;
/**
* Youtube Controller
*/
/**
* Youtube Controller
*/
case $this->core->sysConfig->video_channels->youtube->id:
$intVideoTypeId = 2;
$strVideoTypeName = "YouTube";
$objResponse = new Zend_Gdata_YouTube();
$objResponse->setMajorProtocolVersion(2);
/**
* Get the selected Video
*/
if (isset($strValue)) {
$objSelectedVideo = $objResponse->getVideoEntry($strValue);
}
break;
}
$this->view->strVideoTypeName = $strVideoTypeName;
$this->view->intVideoTypeId = $intVideoTypeId;
$this->view->objSelectedVideo = $objSelectedVideo;
$this->view->strValue = $strValue;
$this->view->strElementId = $strElementId;
$this->view->strChannelUserId = $strChannelUserId;
} catch (Exception $exc) {
$this->core->logger->err($exc);
exit;
}
}
示例15: echoVideoPlayer
/**
* Echo the video embed code, related videos and videos owned by the same user
* as the specified videoId.
*
* @param string $videoId The video
*/
function echoVideoPlayer($videoId)
{
$yt = new Zend_Gdata_YouTube();
$entry = $yt->getVideoEntry($videoId);
$videoTitle = $entry->mediaGroup->title;
$videoUrl = findFlashUrl($entry);
$relatedVideoFeed = getRelatedVideos($entry->getVideoId());
$topRatedFeed = getTopRatedVideosByUser($entry->author[0]->name);
print <<<END
<b>$videoTitle</b><br />
<object width="425" height="350">
<param name="movie" value="${videoUrl}&autoplay=1"></param>
<param name="wmode" value="transparent"></param>
<embed src="${videoUrl}&autoplay=1" type="application/x-shockwave-flash" wmode="transparent"
width=425" height="350"></embed>
</object>
END;
echo '<br />';
echoVideoMetadata($entry);
echo '<br /><b>Related:</b><br />';
echoThumbnails($relatedVideoFeed);
echo '<br /><b>Top rated videos by user:</b><br />';
echoThumbnails($topRatedFeed);
}