Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Zend_Gdata_YouTube Class Reference

Public Member Functions

 __construct ($client=null, $applicationId= 'MyCompany-MyApp-1.0', $clientId=null, $developerKey=null)
 Create Zend_Gdata_YouTube object.
 
 setHttpClient ($client, $applicationId= 'MyCompany-MyApp-1.0', $clientId=null, $developerKey=null)
 Set the Zend_Http_Client object used for communication.
 
 getVideoFeed ($location=null)
 Retrieves a feed of videos.
 
 getVideoEntry ($videoId=null, $location=null, $fullEntry=false)
 Retrieves a specific video entry.
 
 getFullVideoEntry ($videoId)
 Retrieves a video entry from the user's upload feed.
 
 getRelatedVideoFeed ($videoId=null, $location=null)
 Retrieves a feed of videos related to the specified video ID.
 
 getVideoResponseFeed ($videoId=null, $location=null)
 Retrieves a feed of video responses related to the specified video ID.
 
 getVideoCommentFeed ($videoId=null, $location=null)
 Retrieves a feed of comments related to the specified video ID.
 
 getTopRatedVideoFeed ($location=null)
 Retrieves a feed of comments related to the specified video ID.
 
 getMostViewedVideoFeed ($location=null)
 Retrieves a feed of the most viewed videos.
 
 getRecentlyFeaturedVideoFeed ($location=null)
 Retrieves a feed of recently featured videos.
 
 getWatchOnMobileVideoFeed ($location=null)
 Retrieves a feed of videos recently featured for mobile devices.
 
 getPlaylistListFeed ($user=null, $location=null)
 Retrieves a feed which lists a user's playlist.
 
 getPlaylistVideoFeed ($location)
 Retrieves a feed of videos in a particular playlist.
 
 getSubscriptionFeed ($user=null, $location=null)
 Retrieves a feed of a user's subscriptions.
 
 getContactFeed ($user=null, $location=null)
 Retrieves a feed of a user's contacts.
 
 getUserUploads ($user=null, $location=null)
 Retrieves a user's uploads.
 
 getUserFavorites ($user=null, $location=null)
 Retrieves a user's favorites.
 
 getUserProfile ($user=null, $location=null)
 Retrieves a user's profile as an entry.
 
 getFormUploadToken ($videoEntry, $url='https://gdata.youtube.com/action/GetUploadToken')
 Retrieves a YouTube token.
 
 getActivityForUser ($username)
 Retrieves the activity feed for users.
 
 getFriendActivityForCurrentUser ()
 Retrieve the activity of the currently authenticated users friend.
 
 getInboxFeedForCurrentUser ()
 Retrieve a feed of messages in the currently authenticated user's inbox.
 
 sendVideoMessage ($body, $videoEntry=null, $videoId=null, $recipientUserName)
 Send a video message.
 
 replyToCommentEntry ($commentEntry, $commentText)
 Post a comment in reply to an existing comment.
 
- Public Member Functions inherited from Zend_Gdata_Media
 __construct ($client=null, $applicationId= 'MyCompany-MyApp-1.0')
 Create Gdata_Media object.
 
- Public Member Functions inherited from Zend_Gdata
 __construct ($client=null, $applicationId= 'MyCompany-MyApp-1.0')
 Create Gdata object.
 
 getFeed ($location, $className='Zend_Gdata_Feed')
 Retrieve feed as string or object.
 
 getEntry ($location, $className='Zend_Gdata_Entry')
 Retrieve entry as string or object.
 
 performHttpRequest ($method, $url, $headers=array(), $body=null, $contentType=null, $remainingRedirects=null)
 Performs a HTTP request using the specified method.
 
 isAuthenticated ()
 Determines whether service object is authenticated.
 
- Public Member Functions inherited from Zend_Gdata_App
 __construct ($client=null, $applicationId= 'MyCompany-MyApp-1.0')
 Create Gdata object.
 
 registerPackage ($name)
 Adds a Zend Framework package to the $_registeredPackages array.
 
 getFeed ($uri, $className='Zend_Gdata_App_Feed')
 Retrieve feed as string or object.
 
 getEntry ($uri, $className='Zend_Gdata_App_Entry')
 Retrieve entry as string or object.
 
 getHttpClient ()
 Get the Zend_Http_Client object used for communication.
 
 setHttpClient ($client, $applicationId= 'MyCompany-MyApp-1.0')
 Set the Zend_Http_Client object used for communication.
 
 setMajorProtocolVersion ($value)
 Set the major protocol version that should be used.
 
 getMajorProtocolVersion ()
 Get the major protocol version that is in use.
 
 setMinorProtocolVersion ($value)
 Set the minor protocol version that should be used.
 
 getMinorProtocolVersion ()
 Get the minor protocol version that is in use.
 
 prepareRequest ($method, $url=null, $headers=array(), $data=null, $contentTypeOverride=null)
 Provides pre-processing for HTTP requests to APP services.
 
 performHttpRequest ($method, $url, $headers=null, $body=null, $contentType=null, $remainingRedirects=null)
 Performs a HTTP request using the specified method.
 
 importUrl ($url, $className='Zend_Gdata_App_Feed', $extraHeaders=array())
 Imports the specified URL (non-statically).
 
 get ($uri, $extraHeaders=array())
 GET a URI using client object.
 
 post ($data, $uri=null, $remainingRedirects=null, $contentType=null, $extraHeaders=null)
 POST data with client object.
 
 put ($data, $uri=null, $remainingRedirects=null, $contentType=null, $extraHeaders=null)
 PUT data with client object.
 
 delete ($data, $remainingRedirects=null)
 DELETE entry with client object.
 
 insertEntry ($data, $uri, $className='Zend_Gdata_App_Entry', $extraHeaders=array())
 Inserts an entry to a given URI and returns the response as a fully formed Entry.
 
 updateEntry ($data, $uri=null, $className=null, $extraHeaders=array())
 Update an entry.
 
 __call ($method, $args)
 Provides a magic factory method to instantiate new objects with shorter syntax than would otherwise be required by the Zend Framework naming conventions.
 
 retrieveAllEntriesForFeed ($feed)
 Retrieve all entries for a feed, iterating through pages as necessary.
 
 enableRequestDebugLogging ($logfile)
 This method enables logging of requests by changing the Zend_Http_Client_Adapter used for performing the requests.
 
 getNextFeed ($feed, $className=null)
 Retrieve next set of results based on a given feed.
 
 getPreviousFeed ($feed, $className=null)
 Retrieve previous set of results based on a given feed.
 
 generateIfMatchHeaderData ($data, $allowWeek)
 Returns the data for an If-Match header based on the current Etag property.
 
 usingObjectMapping ()
 Determine whether service object is using XML to object mapping.
 
 useObjectMapping ($value)
 Enable/disable the use of XML to object mapping.
 

Static Public Member Functions

static parseFormUploadTokenResponse ($response)
 Helper function for parsing a YouTube token response.
 

Public Attributes

const AUTH_SERVICE_NAME = 'youtube'
 
const CLIENTLOGIN_URL = 'https://www.google.com/youtube/accounts/ClientLogin'
 
const STANDARD_TOP_RATED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/top_rated'
 
const STANDARD_MOST_VIEWED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'
 
const STANDARD_RECENTLY_FEATURED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'
 
const STANDARD_WATCH_ON_MOBILE_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'
 
const STANDARD_TOP_RATED_URI_V2
 
const STANDARD_MOST_VIEWED_URI_V2
 
const STANDARD_RECENTLY_FEATURED_URI_V2
 
const STANDARD_WATCH_ON_MOBILE_URI_V2
 
const USER_URI = 'https://gdata.youtube.com/feeds/api/users'
 
const VIDEO_URI = 'https://gdata.youtube.com/feeds/api/videos'
 
const PLAYLIST_REL = 'http://gdata.youtube.com/schemas/2007#playlist'
 
const USER_UPLOADS_REL = 'http://gdata.youtube.com/schemas/2007#user.uploads'
 
const USER_PLAYLISTS_REL = 'http://gdata.youtube.com/schemas/2007#user.playlists'
 
const USER_SUBSCRIPTIONS_REL = 'http://gdata.youtube.com/schemas/2007#user.subscriptions'
 
const USER_CONTACTS_REL = 'http://gdata.youtube.com/schemas/2007#user.contacts'
 
const USER_FAVORITES_REL = 'http://gdata.youtube.com/schemas/2007#user.favorites'
 
const VIDEO_RESPONSES_REL = 'http://gdata.youtube.com/schemas/2007#video.responses'
 
const VIDEO_RATINGS_REL = 'http://gdata.youtube.com/schemas/2007#video.ratings'
 
const VIDEO_COMPLAINTS_REL = 'http://gdata.youtube.com/schemas/2007#video.complaints'
 
const ACTIVITY_FEED_URI = 'https://gdata.youtube.com/feeds/api/events'
 
const FRIEND_ACTIVITY_FEED_URI
 
const IN_REPLY_TO_SCHEME
 
const INBOX_FEED_URI
 
const ACTIVITY_FEED_MAX_USERS = 20
 
const FAVORITES_URI_SUFFIX = 'favorites'
 
const UPLOADS_URI_SUFFIX = 'uploads'
 
const RESPONSES_URI_SUFFIX = 'responses'
 
const RELATED_URI_SUFFIX = 'related'
 
const INBOX_URI_SUFFIX = 'inbox'
 

Static Public Attributes

static $namespaces
 
- Static Public Attributes inherited from Zend_Gdata_Media
static $namespaces
 
- Static Public Attributes inherited from Zend_Gdata
static $namespaces
 

Additional Inherited Members

- Protected Attributes inherited from Zend_Gdata
 $_defaultPostUri = null
 
 $_registeredPackages
 
 $_httpClient
 
- Static Protected Attributes inherited from Zend_Gdata
static $_staticHttpClient = null
 

Constructor & Destructor Documentation

__construct (   $client = null,
  $applicationId = 'MyCompany-MyApp-1.0',
  $clientId = null,
  $developerKey = null 
)

Create Zend_Gdata_YouTube object.

Parameters
Zend_Http_Client$client(optional) The HTTP client to use when when communicating with the Google servers.
string$applicationIdThe identity of the app in the form of Company-AppName-Version
string$clientIdThe clientId issued by the YouTube dashboard
string$developerKeyThe developerKey issued by the YouTube dashboard

Member Function Documentation

getActivityForUser (   $username)

Retrieves the activity feed for users.

Parameters
mixed$usernamesA string identifying the usernames for which to retrieve activity for. This can also be a Zend_Gdata_Query object from which a URL can be determined.
Exceptions
Zend_Gdata_App_VersionExceptionif using version less than 2.
Returns
Zend_Gdata_YouTube_ActivityFeed
getContactFeed (   $user = null,
  $location = null 
)

Retrieves a feed of a user's contacts.

Parameters
string$user(optional) The username of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_ContactFeed The feed of contacts
getFormUploadToken (   $videoEntry,
  $url = 'https://gdata.youtube.com/action/GetUploadToken' 
)

Retrieves a YouTube token.

Parameters
Zend_Gdata_YouTube_VideoEntry$videoEntryThe video entry
string$urlThe location as a string URL
Exceptions
Zend_Gdata_App_Exception
Returns
array An array containing a token and URL
getFriendActivityForCurrentUser ( )

Retrieve the activity of the currently authenticated users friend.

Exceptions
Zend_Gdata_App_Exceptionif not logged in.
Returns
Zend_Gdata_YouTube_ActivityFeed
getFullVideoEntry (   $videoId)

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

Parameters
mixed$videoIDThe ID of the video to retrieve.
Exceptions
Zend_Gdata_App_HttpException
Returns
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.
getInboxFeedForCurrentUser ( )

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

Exceptions
Zend_Gdata_App_Exceptionif not logged in.
Returns
Zend_Gdata_YouTube_InboxFeed|null
getMostViewedVideoFeed (   $location = null)

Retrieves a feed of the most viewed videos.

Parameters
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
getPlaylistListFeed (   $user = null,
  $location = null 
)

Retrieves a feed which lists a user's playlist.

Parameters
string$user(optional) The username of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_PlaylistListFeed The feed of playlists
getPlaylistVideoFeed (   $location)

Retrieves a feed of videos in a particular playlist.

Parameters
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_PlaylistVideoFeed The feed of videos found at the specified URL.
getRecentlyFeaturedVideoFeed (   $location = null)

Retrieves a feed of recently featured videos.

Parameters
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
getRelatedVideoFeed (   $videoId = null,
  $location = null 
)

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

Parameters
string$videoIdThe videoId of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
getSubscriptionFeed (   $user = null,
  $location = null 
)

Retrieves a feed of a user's subscriptions.

Parameters
string$user(optional) The username of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_SubscriptionListFeed The feed of subscriptions
getTopRatedVideoFeed (   $location = null)

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

Parameters
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_CommentFeed The feed of videos found at the specified URL.
getUserFavorites (   $user = null,
  $location = null 
)

Retrieves a user's favorites.

Parameters
string$user(optional) The username of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_VideoFeed The videos favorited by the user
getUserProfile (   $user = null,
  $location = null 
)

Retrieves a user's profile as an entry.

Parameters
string$user(optional) The username of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_UserProfileEntry The user profile entry
getUserUploads (   $user = null,
  $location = null 
)

Retrieves a user's uploads.

Parameters
string$user(optional) The username of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_VideoFeed The videos uploaded by the user
getVideoCommentFeed (   $videoId = null,
  $location = null 
)

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

Parameters
string$videoIdThe videoId of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_CommentFeed The feed of videos found at the specified URL.
getVideoEntry (   $videoId = null,
  $location = null,
  $fullEntry = false 
)

Retrieves a specific video entry.

Parameters
mixed$videoIdThe ID of the video to retrieve.
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined.
boolean$fullEntry(optional) Retrieve the full metadata for the entry. Only possible if entry belongs to currently authenticated user. An exception will be thrown otherwise.
Exceptions
Zend_Gdata_App_HttpException
Returns
Zend_Gdata_YouTube_VideoEntry The video entry found at the specified URL.
getVideoFeed (   $location = null)

Retrieves a feed of videos.

Parameters
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
getVideoResponseFeed (   $videoId = null,
  $location = null 
)

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

Parameters
string$videoIdThe videoId of interest
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
getWatchOnMobileVideoFeed (   $location = null)

Retrieves a feed of videos recently featured for mobile devices.

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

Parameters
mixed$location(optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined
Returns
Zend_Gdata_YouTube_VideoFeed The feed of videos found at the specified URL.
static parseFormUploadTokenResponse (   $response)
static

Helper function for parsing a YouTube token response.

Parameters
string$responseThe service response
Exceptions
Zend_Gdata_App_Exception
Returns
array An array containing the token and URL
replyToCommentEntry (   $commentEntry,
  $commentText 
)

Post a comment in reply to an existing comment.

Parameters
Zend_Gdata_YouTube_CommentEntry$commentEntryThe comment entry to reply to
string$commentTextThe text of the comment to post
Returns
Zend_Gdata_YouTube_CommentEntry the posted comment
sendVideoMessage (   $body,
  $videoEntry = null,
  $videoId = null,
  $recipientUserName 
)

Send a video message.

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

Parameters
string$bodyThe body of the message
Zend_Gdata_YouTube_VideoEntry(optional) The video entry to send
string$videoIdThe id of the video to send
string$recipientUserNameThe username of the recipient
Exceptions
Zend_Gdata_App_InvalidArgumentExceptionif no valid Zend_Gdata_YouTube_VideoEntry or videoId were provided
Returns
Zend_Gdata_YouTube_InboxEntry|null The Zend_Gdata_YouTube_Inbox_Entry representing the sent message.
setHttpClient (   $client,
  $applicationId = 'MyCompany-MyApp-1.0',
  $clientId = null,
  $developerKey = null 
)

Set the Zend_Http_Client object used for communication.

Parameters
Zend_Http_Client$clientThe client to use for communication
Exceptions
Zend_Gdata_App_HttpException
Returns
Zend_Gdata_App Provides a fluent interface

Member Data Documentation

$namespaces
static
Initial value:
= array(
array('yt', 'http://gdata.youtube.com/schemas/2007', 1, 0),
array('georss', 'http://www.georss.org/georss', 1, 0),
array('gml', 'http://www.opengis.net/gml', 1, 0),
array('media', 'http://search.yahoo.com/mrss/', 1, 0)
)
const ACTIVITY_FEED_MAX_USERS = 20
const ACTIVITY_FEED_URI = 'https://gdata.youtube.com/feeds/api/events'
const AUTH_SERVICE_NAME = 'youtube'
const CLIENTLOGIN_URL = 'https://www.google.com/youtube/accounts/ClientLogin'
const FAVORITES_URI_SUFFIX = 'favorites'
const FRIEND_ACTIVITY_FEED_URI
Initial value:
=
'https://gdata.youtube.com/feeds/api/users/default/friendsactivity'
const IN_REPLY_TO_SCHEME
Initial value:
=
'http://gdata.youtube.com/schemas/2007#in-reply-to'
const INBOX_FEED_URI
Initial value:
=
'https://gdata.youtube.com/feeds/api/users/default/inbox'
const INBOX_URI_SUFFIX = 'inbox'
const PLAYLIST_REL = 'http://gdata.youtube.com/schemas/2007#playlist'
const RELATED_URI_SUFFIX = 'related'
const RESPONSES_URI_SUFFIX = 'responses'
const STANDARD_MOST_VIEWED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'
const STANDARD_MOST_VIEWED_URI_V2
Initial value:
=
'https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'
const STANDARD_RECENTLY_FEATURED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'
const STANDARD_RECENTLY_FEATURED_URI_V2
Initial value:
=
'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'
const STANDARD_TOP_RATED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/top_rated'
const STANDARD_TOP_RATED_URI_V2
Initial value:
=
'https://gdata.youtube.com/feeds/api/standardfeeds/top_rated'
const STANDARD_WATCH_ON_MOBILE_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'
const STANDARD_WATCH_ON_MOBILE_URI_V2
Initial value:
=
'https://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'
const UPLOADS_URI_SUFFIX = 'uploads'
const USER_CONTACTS_REL = 'http://gdata.youtube.com/schemas/2007#user.contacts'
const USER_FAVORITES_REL = 'http://gdata.youtube.com/schemas/2007#user.favorites'
const USER_PLAYLISTS_REL = 'http://gdata.youtube.com/schemas/2007#user.playlists'
const USER_SUBSCRIPTIONS_REL = 'http://gdata.youtube.com/schemas/2007#user.subscriptions'
const USER_UPLOADS_REL = 'http://gdata.youtube.com/schemas/2007#user.uploads'
const USER_URI = 'https://gdata.youtube.com/feeds/api/users'
const VIDEO_COMPLAINTS_REL = 'http://gdata.youtube.com/schemas/2007#video.complaints'
const VIDEO_RATINGS_REL = 'http://gdata.youtube.com/schemas/2007#video.ratings'
const VIDEO_RESPONSES_REL = 'http://gdata.youtube.com/schemas/2007#video.responses'
const VIDEO_URI = 'https://gdata.youtube.com/feeds/api/videos'