当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Gdata_YouTube::getUserUploads方法代码示例

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


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

示例1: getVideosByUser

 /**
  * get videos uploaded by username
  * @param string $username
  * @return Zend_Gdata_YouTube_VideoFeed 
  */
 public function getVideosByUser($user, $page = 0)
 {
     /* @var $ytq Zend_Gdata_YouTube_VideoQuery */
     $ytq = $this->yt->newVideoQuery(Zend_Gdata_YouTube::USER_URI . '/' . $user . '/' . Zend_Gdata_YouTube::UPLOADS_URI_SUFFIX);
     $page = $page * self::ITEMS_PER_PAGE;
     $ytq->setStartIndex($page == 0 ? $page : $page + 1);
     $ytq->setMaxResults(self::ITEMS_PER_PAGE);
     $ytq->setOrderBy('published');
     return $this->yt->getUserUploads(null, $ytq);
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:15,代码来源:Youtube.php

示例2: get_user_object_list_feed

 /**
  *
  * @param  string $object
  * @param  int    $offset_start
  * @param  int    $quantity
  * @return string
  */
 protected function get_user_object_list_feed($object, $offset_start, $quantity)
 {
     $feed = null;
     switch ($object) {
         case self::ELEMENT_TYPE_VIDEO:
             $uri = Zend_Gdata_YouTube::USER_URI . '/default/' . Zend_Gdata_YouTube::UPLOADS_URI_SUFFIX;
             $query = new Zend_Gdata_Query($uri);
             if ($quantity !== 0) {
                 $query->setMaxResults($quantity);
             }
             $query->setStartIndex($offset_start);
             $feed = $this->_api->getUserUploads(null, $query);
             break;
         case self::CONTAINER_TYPE_PLAYLIST:
             $uri = Zend_Gdata_YouTube::USER_URI . '/default/playlists';
             $query = new Zend_Gdata_Query($uri);
             if ($quantity !== 0) {
                 $query->setMaxResults($quantity);
             }
             $query->setStartIndex($offset_start);
             $feed = $this->_api->getPlaylistListFeed(null, $query);
             break;
         default:
             throw new Bridge_Exception_ObjectUnknown('Unknown object ' . $object);
             break;
     }
     return $feed;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:35,代码来源:Youtube.php

示例3: 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

示例4: 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

示例5: 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

示例6: searchVideos

/**
 * Perform a search on youtube. Passes the result feed to echoVideoList.
 *
 * @param string $searchType The type of search to perform.
 * If set to 'owner' then attempt to authenticate.
 * @param string $searchTerm The term to search on.
 * @param string $startIndex Start retrieving search results from this index.
 * @param string $maxResults The number of results to retrieve.
 * @return void
 */
function searchVideos($searchType, $searchTerm, $startIndex, $maxResults)
{
    // create an unauthenticated service object
    $youTubeService = new Zend_Gdata_YouTube();
    $query = $youTubeService->newVideoQuery();
    $query->setQuery($searchTerm);
    $query->setStartIndex($startIndex);
    $query->setMaxResults($maxResults);
    switch ($searchType) {
        case 'most_viewed':
            $query->setFeedType('most viewed');
            $query->setTime('this_week');
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'most_recent':
            $query->setFeedType('most recent');
            $query->setTime('this_week');
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'recently_featured':
            $query->setFeedType('recently featured');
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'top_rated':
            $query->setFeedType('top rated');
            $query->setTime('this_week');
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'username':
            $feed = $youTubeService->getUserUploads($searchTerm);
            break;
        case 'all':
            $feed = $youTubeService->getVideoFeed($query);
            break;
        case 'owner':
            $httpClient = getAuthSubHttpClient();
            $youTubeService = new Zend_Gdata_YouTube($httpClient);
            try {
                $feed = $youTubeService->getUserUploads('default');
                if (loggingEnabled()) {
                    logMessage($httpClient->getLastRequest(), 'request');
                    logMessage($httpClient->getLastResponse()->getBody(), 'response');
                }
            } 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;
            } catch (Zend_Gdata_App_Exception $e) {
                print 'ERROR - Could not retrieve users video feed: ' . $e->getMessage() . '<br />';
                return;
            }
            echoVideoList($feed, true);
            return;
        default:
            echo 'ERROR - Unknown search type - \'' . $searchType . '\'';
            return;
    }
    if (loggingEnabled()) {
        $httpClient = $youTubeService->getHttpClient();
        logMessage($httpClient->getLastRequest(), 'request');
        logMessage($httpClient->getLastResponse()->getBody(), 'response');
    }
    echoVideoList($feed);
}
开发者ID:holdensmagicalunicorn,项目名称:copperFramework,代码行数:73,代码来源:operations.php

示例7: getUserVideos

 /**
  * Retrieve video of based upon a user
  *
  * @access public
  * @return gVideo
  * @throws Exception
  */
 public function getUserVideos()
 {
     if ($this->getUsername() == "") {
         throw new Exception("Empty username was passed");
     } else {
         try {
             $yt = new Zend_Gdata_YouTube();
             $videoFeed = $yt->getUserUploads($this->getUsername());
             foreach ($videoFeed as $videoEntry) {
                 $gVideo = new CW_Google_Video_YouTube($videoFeed->totalResults->text, $videoEntry->mediaGroup->title->text, $videoEntry->getPublished()->text, $videoEntry->getId()->text, $videoEntry->updated->text, $videoEntry->mediaGroup->duration->seconds, $videoEntry->mediaGroup->content[0]->medium, $videoEntry->comments->feedLink->href, $videoEntry->mediaGroup->content[0]->url, $videoEntry->mediaGroup->keywords->text, $videoEntry->mediaGroup->thumbnail[0]->url, $videoEntry->mediaGroup->thumbnail[0]->width, $videoEntry->mediaGroup->thumbnail[0]->height, $videoEntry->mediaGroup->thumbnail[0]->time, $videoEntry->mediaGroup->player[0]->url, $videoEntry->mediaGroup->category[0]->text, $videoEntry->getContent()->text, $videoEntry->mediaGroup->description->text, $videoEntry->getRating(), $videoEntry->getRacy(), $videoEntry->statistics->viewCount);
                 $this->setVideos($gVideo);
             }
         } catch (Zend_Gdata_App_Exception $ex) {
             print $ex->getMessage();
         } catch (Exception $e) {
             print $e->getMessage();
         }
     }
     return $this->getVideos();
 }
开发者ID:kwylez,项目名称:CW-Google,代码行数:27,代码来源:Util.php

示例8: runYouTubeJob

/**
 * runYouTubeJob 
 * 
 * Imports YouTube videos.
 * 
 * @return void
 */
function runYouTubeJob()
{
    global $file;
    require_once 'constants.php';
    require_once 'socialmedia.php';
    require_once 'datetime.php';
    require_once THIRDPARTY . 'gettext.inc';
    set_include_path(THIRDPARTY);
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata_YouTube');
    Zend_Loader::loadClass('Zend_Gdata_AuthSub');
    Zend_Loader::loadClass('Zend_Gdata_App_Exception');
    $fcmsError = FCMS_Error::getInstance();
    $fcmsDatabase = Database::getInstance($fcmsError);
    $existingIds = getExistingYouTubeIds();
    // Get user's session tokens
    $sql = "SELECT u.`id`, s.`youtube_session_token`\n            FROM `fcms_user_settings` AS s, `fcms_users` AS u\n            WHERE s.`user` = u.`id`\n            AND s.`youtube_session_token` IS NOT NULL";
    $rows = $fcmsDatabase->getRows($sql);
    if ($rows === false) {
        logError(__FILE__ . ' [' . __LINE__ . '] - Could not get youtube tokens.');
        die;
    }
    $sessionTokens = array();
    foreach ($rows as $row) {
        $sessionTokens[$row['id']] = $row['youtube_session_token'];
    }
    $youtubeConfig = getYouTubeConfigData();
    // Get videos for each user
    foreach ($sessionTokens as $userId => $token) {
        // Setup youtube api
        $httpClient = getYouTubeAuthSubHttpClient($youtubeConfig['youtube_key'], $token);
        $youTubeService = new Zend_Gdata_YouTube($httpClient);
        $feed = $youTubeService->getUserUploads('default');
        $values = '';
        $videoCount = 0;
        $params = array();
        foreach ($feed as $entry) {
            $id = $entry->getVideoId();
            if (isset($existingIds[$id])) {
                continue;
            }
            $title = htmlspecialchars($entry->getVideoTitle());
            $description = htmlspecialchars($entry->getVideoDescription());
            $created = formatDate('Y-m-d H:i:s', $entry->published);
            $duration = $entry->getVideoDuration();
            $height = '420';
            $width = '780';
            $thumbs = $entry->getVideoThumbnails();
            if (count($thumbs) > 0) {
                $height = $thumbs[0]['height'];
                $width = $thumbs[0]['width'];
            }
            $values .= "(?, ?, ?, 'youtube', ?, ?, ?, ?, NOW(), ?),";
            $params[] = $id;
            $params[] = $title;
            $params[] = $description;
            $params[] = $height;
            $params[] = $width;
            $params[] = $created;
            $params[] = $userId;
            $params[] = $userId;
            $videoCount++;
        }
        if ($videoCount > 0) {
            $values = substr($values, 0, -1);
            // remove comma
            $sql = "INSERT INTO `fcms_video`\n                        (`source_id`, `title`, `description`, `source`, `height`, `width`, `created`, `created_id`, `updated`, `updated_id`)\n                    VALUES {$values}";
            if (!$fcmsDatabase->insert($sql, $params)) {
                logError(__FILE__ . ' [' . __LINE__ . '] - Could not insert new video to db.');
                die;
            }
        }
    }
    // Update date we last ran this job
    updateLastRun(date('Y-m-d H:i:s'), 'youtube');
}
开发者ID:sauravpratihar,项目名称:fcms,代码行数:83,代码来源:cron.php

示例9: indexAction

		function indexAction()
		{
			//echo $this->user_login;die();
			//echo $this->user_youtube.' - '.$this->pass_youtube.' - '.$this->gallery;
			$this->view->headTitle('UNC - Admin website');
			$this->view->headLink()->appendStylesheet($this->view->baseUrl().'/application/templates/admin/css/layout.css');
			$this->view->headScript()->appendFile($this->view->baseUrl().'/application/templates/admin/js/jquery-1.7.2.min.js','text/javascript');
			$this->view->headScript()->appendFile($this->view->baseUrl().'/application/templates/admin/js/hideshow.js','text/javascript');
			
			$youtube  = new Zend_Gdata_YouTube();
		 
		    try {
		        $feed = $youtube->getUserUploads($this->gallery);
				foreach ($feed as $video)
				 	{
				 		$video_link = $video->getVideoId();
				 		if($this->mVideo->exitsVideo($video_link)==false)
						{
							$input = array(
											'video_title'		=> $video->getVideoTitle(),
											'video_alias'		=> $this->getAliasByName($video->getVideoTitle()),
											'video_description' => $video->getVideoDescription(),
											'video_link'		=> $video_link,
											'user_upload'		=> $this->user_login
							);
							//var_dump($input);die();
							$this->mVideo->insertVideo($input,$this->id_youtube);
						}
					}
		    }
		    catch (Exception $ex) {
		        echo $ex->getMessage();
		        exit;
		    }
			
			if($this->role == "0" | $this->role == "2")
			{
				$listVideo = $this->mVideo->getListVideo();
			}
			if($this->role == "1")
			{
				$allVideo = $this->mVideo->getListVideo();
				$listCategoryId = $this->mVideo->getCategoryIdByUserId($this->user_id);
				$listVideo = array();
				foreach($allVideo as $video)
				{
					foreach($listCategoryId as $categoryId)
					{
						if($video['category_id'] == $categoryId['category_id'])
						{
							$listVideo[] = $video;
						}
					}
				}
			}
			
			//var_dump($this->mVideo->getListVideo());die();
        	$this->view->list = $listVideo;
			$this->view->title = 'Quản lý video';
			
			$this->view->role = $this->role;
			$this->view->user_login = $this->user_login;
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:63,代码来源:UploadvideoController.php


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