API Documentation

Zend/Gdata/YouTube.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Gdata  
Subpackage
YouTube  
Version
$Id: YouTube.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Gdata_YouTube

Package: Zend\Gdata\YouTube

Service class for interacting with the YouTube Data API.

Parent(s)
\Zend_Gdata_Media < \Zend_Gdata < \Zend_Gdata_App
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Link
http://code.google.com/apis/youtube/  

Constants

Constant  AUTH_SERVICE_NAME = 'youtube'
Constant  CLIENTLOGIN_URL = 'https://www.google.com/youtube/accounts/ClientLogin'
Constant  STANDARD_TOP_RATED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/top_rated'
Constant  STANDARD_MOST_VIEWED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'
Constant  STANDARD_RECENTLY_FEATURED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'
Constant  STANDARD_WATCH_ON_MOBILE_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'
Constant  STANDARD_TOP_RATED_URI_V2 = 'https://gdata.youtube.com/feeds/api/standardfeeds/top_rated'
Constant  STANDARD_MOST_VIEWED_URI_V2 = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'
Constant  STANDARD_RECENTLY_FEATURED_URI_V2 = 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'
Constant  STANDARD_WATCH_ON_MOBILE_URI_V2 = 'https://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'
Constant  USER_URI = 'https://gdata.youtube.com/feeds/api/users'
Constant  VIDEO_URI = 'https://gdata.youtube.com/feeds/api/videos'
Constant  PLAYLIST_REL = 'http://gdata.youtube.com/schemas/2007#playlist'
Constant  USER_UPLOADS_REL = 'http://gdata.youtube.com/schemas/2007#user.uploads'
Constant  USER_PLAYLISTS_REL = 'http://gdata.youtube.com/schemas/2007#user.playlists'
Constant  USER_SUBSCRIPTIONS_REL = 'http://gdata.youtube.com/schemas/2007#user.subscriptions'
Constant  USER_CONTACTS_REL = 'http://gdata.youtube.com/schemas/2007#user.contacts'
Constant  USER_FAVORITES_REL = 'http://gdata.youtube.com/schemas/2007#user.favorites'
Constant  VIDEO_RESPONSES_REL = 'http://gdata.youtube.com/schemas/2007#video.responses'
Constant  VIDEO_RATINGS_REL = 'http://gdata.youtube.com/schemas/2007#video.ratings'
Constant  VIDEO_COMPLAINTS_REL = 'http://gdata.youtube.com/schemas/2007#video.complaints'
Constant  ACTIVITY_FEED_URI = 'https://gdata.youtube.com/feeds/api/events'
Constant  FRIEND_ACTIVITY_FEED_URI = 'https://gdata.youtube.com/feeds/api/users/default/friendsactivity'
Constantstring  IN_REPLY_TO_SCHEME = 'http://gdata.youtube.com/schemas/2007#in-reply-to'

The URI of the in-reply-to schema for comments in reply to other comments.

string
Constantstring  INBOX_FEED_URI = 'https://gdata.youtube.com/feeds/api/users/default/inbox'

The URI of the inbox feed for the currently authenticated user.

string
Constantinteger  ACTIVITY_FEED_MAX_USERS = 20

The maximum number of users for which activity can be requested for, as enforced by the API.

integer
Constantstring  FAVORITES_URI_SUFFIX = 'favorites'

The suffix for a feed of favorites.

string
Constantstring  UPLOADS_URI_SUFFIX = 'uploads'

The suffix for the user's upload feed.

string
Constantstring  RESPONSES_URI_SUFFIX = 'responses'

The suffix for a feed of video responses.

string
Constantstring  RELATED_URI_SUFFIX = 'related'

The suffix for a feed of related videos.

string
Constantstring  INBOX_URI_SUFFIX = 'inbox'

The suffix for a feed of messages (inbox entries).

string

Properties

Propertypublicarray  $namespaces= 'array( array('yt''
static

Namespaces used for Zend_Gdata_YouTube

Default valuearray( array('yt'Details
Type
array

Methods

methodpublic__construct( \Zend_Http_Client $client = null, string $applicationId = 'MyCompany-MyApp-1.0', string $clientId = null, string $developerKey = null ) : void

Create Zend_Gdata_YouTube object

Parameters
Name Type Description
$client \Zend_Http_Client

(optional) The HTTP client to use when when communicating with the Google servers.

$applicationId string

The identity of the app in the form of Company-AppName-Version

$clientId string

The clientId issued by the YouTube dashboard

$developerKey string

The developerKey issued by the YouTube dashboard

methodpublicgetActivityForUser(  $username ) : \Zend_Gdata_YouTube_ActivityFeed

Retrieves the activity feed for users

Parameters
Name Type Description
$username
Returns
Type Description
\Zend_Gdata_YouTube_ActivityFeed
Throws
Exception Description
\Zend_Gdata_App_VersionException if using version less than 2.
methodpublicgetContactFeed( string $user = null, mixed $location = null ) : \Zend_Gdata_YouTube_ContactFeed

Retrieves a feed of a user's contacts

Parameters
Name Type Description
$user string

(optional) The username of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_ContactFeed The feed of contacts
methodpublicgetFormUploadToken( \Zend_Gdata_YouTube_VideoEntry $videoEntry, string $url = 'https://gdata.youtube.com/action/GetUploadToken' ) : array

Retrieves a YouTube token

Parameters
Name Type Description
$videoEntry \Zend_Gdata_YouTube_VideoEntry

The video entry

$url string

The location as a string URL

Returns
Type Description
array An array containing a token and URL
Throws
Exception Description
\Zend_Gdata_App_Exception
methodpublicgetFriendActivityForCurrentUser( ) : \Zend_Gdata_YouTube_ActivityFeed

Retrieve the activity of the currently authenticated users friend.

Returns
Type Description
\Zend_Gdata_YouTube_ActivityFeed
Throws
Exception Description
\Zend_Gdata_App_Exception if not logged in.
methodpublicgetFullVideoEntry(  $videoId ) : \Zend_Gdata_YouTube_VideoEntry|null

Retrieves a video entry from the user's upload feed.

Parameters
Name Type Description
$videoId
Returns
Type Description
\Zend_Gdata_YouTube_VideoEntry|null The video entry to be retrieved, or null if it was not found or the user requesting it did not have the appropriate permissions.
Throws
Exception Description
\Zend_Gdata_App_HttpException
methodpublicgetInboxFeedForCurrentUser( ) : \Zend_Gdata_YouTube_InboxFeed|null

Retrieve a feed of messages in the currently authenticated user's inbox.

Returns
Type Description
\Zend_Gdata_YouTube_InboxFeed|null
Throws
Exception Description
\Zend_Gdata_App_Exception if not logged in.
methodpublicgetMostViewedVideoFeed( mixed $location = null ) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of the most viewed videos.

Parameters
Name Type Description
$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
methodpublicgetPlaylistListFeed( string $user = null, mixed $location = null ) : \Zend_Gdata_YouTube_PlaylistListFeed

Retrieves a feed which lists a user's playlist

Parameters
Name Type Description
$user string

(optional) The username of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_PlaylistListFeed The feed of playlists
methodpublicgetPlaylistVideoFeed( mixed $location ) : \Zend_Gdata_YouTube_PlaylistVideoFeed

Retrieves a feed of videos in a particular playlist

Parameters
Name Type Description
$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_PlaylistVideoFeed The feed of videos found at the specified URL.
methodpublicgetRecentlyFeaturedVideoFeed( mixed $location = null ) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of recently featured videos.

Parameters
Name Type Description
$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
methodpublicgetRelatedVideoFeed( string $videoId = null, mixed $location = null ) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of videos related to the specified video ID.

Parameters
Name Type Description
$videoId string

The videoId of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
methodpublicgetSubscriptionFeed( string $user = null, mixed $location = null ) : \Zend_Gdata_YouTube_SubscriptionListFeed

Retrieves a feed of a user's subscriptions

Parameters
Name Type Description
$user string

(optional) The username of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_SubscriptionListFeed The feed of subscriptions
methodpublicgetTopRatedVideoFeed( mixed $location = null ) : \Zend_Gdata_YouTube_CommentFeed

Retrieves a feed of comments related to the specified video ID.

Parameters
Name Type Description
$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_CommentFeed The feed of videos found at the specified URL.
methodpublicgetUserFavorites( string $user = null, mixed $location = null ) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a user's favorites

Parameters
Name Type Description
$user string

(optional) The username of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_VideoFeed The videos favorited by the user
methodpublicgetUserProfile( string $user = null, mixed $location = null ) : \Zend_Gdata_YouTube_UserProfileEntry

Retrieves a user's profile as an entry

Parameters
Name Type Description
$user string

(optional) The username of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_UserProfileEntry The user profile entry
methodpublicgetUserUploads( string $user = null, mixed $location = null ) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a user's uploads

Parameters
Name Type Description
$user string

(optional) The username of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_VideoFeed The videos uploaded by the user
methodpublicgetVideoCommentFeed( string $videoId = null, mixed $location = null ) : \Zend_Gdata_YouTube_CommentFeed

Retrieves a feed of comments related to the specified video ID.

Parameters
Name Type Description
$videoId string

The videoId of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_CommentFeed The feed of videos found at the specified URL.
methodpublicgetVideoEntry( mixed $videoId = null, mixed $location = null, boolean $fullEntry = false ) : \Zend_Gdata_YouTube_VideoEntry

Retrieves a specific video entry.

Parameters
Name Type Description
$videoId mixed

The ID of the video to retrieve.

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined.

$fullEntry boolean

(optional) Retrieve the full metadata for the entry. Only possible if entry belongs to currently authenticated user. An exception will be thrown otherwise.

Returns
Type Description
\Zend_Gdata_YouTube_VideoEntry The video entry found at the specified URL.
Throws
Exception Description
\Zend_Gdata_App_HttpException
methodpublicgetVideoFeed( mixed $location = null ) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of videos.

Parameters
Name Type Description
$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
methodpublicgetVideoResponseFeed( string $videoId = null, mixed $location = null ) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of video responses related to the specified video ID.

Parameters
Name Type Description
$videoId string

The videoId of interest

$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
methodpublicgetWatchOnMobileVideoFeed( mixed $location = null ) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of videos recently featured for mobile devices.

These videos will have RTSP links in the $entry->mediaGroup->content

Parameters
Name Type Description
$location mixed

(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined

Returns
Type Description
\Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
methodpublicparseFormUploadTokenResponse( string $response ) : array
static

Helper function for parsing a YouTube token response

Parameters
Name Type Description
$response string

The service response

Returns
Type Description
array An array containing the token and URL
Throws
Exception Description
\Zend_Gdata_App_Exception
methodpublicreplyToCommentEntry( \Zend_Gdata_YouTube_CommentEntry $commentEntry, string $commentText ) : \Zend_Gdata_YouTube_CommentEntry

Post a comment in reply to an existing comment

Parameters
Name Type Description
$commentEntry \Zend_Gdata_YouTube_CommentEntry

The comment entry to reply to

$commentText string

The text of the comment to post

Returns
Type Description
\Zend_Gdata_YouTube_CommentEntry the posted comment
methodpublicsendVideoMessage( string $body, \Zend_Gdata_YouTube_VideoEntry $videoEntry = null, string $videoId = null, string $recipientUserName ) : \Zend_Gdata_YouTube_InboxEntry|null

Send a video message.

Note: Either a Zend_Gdata_YouTube_VideoEntry or a valid video ID must be provided.

Parameters
Name Type Description
$body string

The body of the message

$videoEntry \Zend_Gdata_YouTube_VideoEntry

(optional) The video entry to send

$videoId string

The id of the video to send

$recipientUserName string

The username of the recipient

Returns
Type Description
\Zend_Gdata_YouTube_InboxEntry|null The Zend_Gdata_YouTube_Inbox_Entry representing the sent message.
Throws
Exception Description
\Zend_Gdata_App_InvalidArgumentException if no valid Zend_Gdata_YouTube_VideoEntry or videoId were provided
methodpublicsetHttpClient( \Zend_Http_Client $client,  $applicationId = 'MyCompany-MyApp-1.0',  $clientId = null,  $developerKey = null ) : \Zend_Gdata_App

Set the Zend_Http_Client object used for communication

Parameters
Name Type Description
$client \Zend_Http_Client

The client to use for communication

$applicationId
$clientId
$developerKey
Returns
Type Description
\Zend_Gdata_App Provides a fluent interface
Throws
Exception Description
\Zend_Gdata_App_HttpException
Documentation was generated by DocBlox 0.15.1.