Gdata/YouTube.php

Show: PublicProtectedPrivateinherited
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 [email protected] so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Gdata  
Subpackage
YouTube  
Version
$Id$  

\Zend_Gdata_YouTube

Package: Zend_Gdata\YouTube
Service class for interacting with the YouTube Data API.
As the Google data API protocol is based upon the Atom Publishing Protocol (APP), Gdata functionality extends the appropriate Zend_Gdata_App classes
Parent(s)
\Zend_Gdata_Media < \Zend_Gdata < \Zend_Gdata_App
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Link
http://code.google.com/apis/youtube/  

Constants

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

>VConstantstring  INBOX_FEED_URI = 'https://gdata.youtube.com/feeds/api/users/default/inbox'
The URI of the inbox feed for the currently authenticated user.
INBOX_FEED_URI
string

>VConstantinteger  ACTIVITY_FEED_MAX_USERS = 20
The maximum number of users for which activity can be requested for, as enforced by the API.
ACTIVITY_FEED_MAX_USERS
integer

>VConstantstring  FAVORITES_URI_SUFFIX = 'favorites'
The suffix for a feed of favorites.
FAVORITES_URI_SUFFIX
string

>VConstantstring  UPLOADS_URI_SUFFIX = 'uploads'
The suffix for the user's upload feed.
UPLOADS_URI_SUFFIX
string

>VConstantstring  RESPONSES_URI_SUFFIX = 'responses'
The suffix for a feed of video responses.
RESPONSES_URI_SUFFIX
string

>VConstantstring  RELATED_URI_SUFFIX = 'related'
The suffix for a feed of related videos.
RELATED_URI_SUFFIX
string

>VConstantstring  INBOX_URI_SUFFIX = 'inbox'
The suffix for a feed of messages (inbox entries).
INBOX_URI_SUFFIX
string

Properties

>VPropertypublicarray $namespaces = 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))
static
Namespaces used for Zend_Gdata_YouTube
Default valuearray(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))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
NameTypeDescription
$client\Zend_Http_Client

(optional) The HTTP client to use when

     when communicating with the Google servers.
$applicationIdstring

The identity of the app in the form of

   Company-AppName-Version
$clientIdstring

The clientId issued by the YouTube dashboard

$developerKeystring

The developerKey issued by the YouTube dashboard

methodpublicgetActivityForUser( $username) : \Zend_Gdata_YouTube_ActivityFeed

Retrieves the activity feed for users

Parameters
NameTypeDescription
$username
Returns
TypeDescription
\Zend_Gdata_YouTube_ActivityFeed
Throws
ExceptionDescription
\Zend_Gdata_App_VersionExceptionif 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
NameTypeDescription
$userstring

(optional) The username of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_ContactFeedThe feed of contacts
methodpublicgetFormUploadToken(\Zend_Gdata_YouTube_VideoEntry $videoEntry, string $url = 'https://gdata.youtube.com/action/GetUploadToken') : array

Retrieves a YouTube token

Parameters
NameTypeDescription
$videoEntry\Zend_Gdata_YouTube_VideoEntry

The video entry

$urlstring

The location as a string URL

Returns
TypeDescription
arrayAn array containing a token and URL
Throws
ExceptionDescription
\Zend_Gdata_App_Exception
methodpublicgetFriendActivityForCurrentUser() : \Zend_Gdata_YouTube_ActivityFeed

Retrieve the activity of the currently authenticated users friend.

Returns
TypeDescription
\Zend_Gdata_YouTube_ActivityFeed
Throws
ExceptionDescription
\Zend_Gdata_App_Exceptionif not logged in.
methodpublicgetFullVideoEntry( $videoId) : \Zend_Gdata_YouTube_VideoEntry | null

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

Parameters
NameTypeDescription
$videoId
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoEntry | nullThe video entry to be retrieved, or null if it was not found or the user requesting it did not have the appropriate permissions.
Throws
ExceptionDescription
\Zend_Gdata_App_HttpException
methodpublicgetInboxFeedForCurrentUser() : \Zend_Gdata_YouTube_InboxFeed | null

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

Returns
TypeDescription
\Zend_Gdata_YouTube_InboxFeed | null
Throws
ExceptionDescription
\Zend_Gdata_App_Exceptionif not logged in.
methodpublicgetMostViewedVideoFeed(mixed $location = null) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of the most viewed videos.

Parameters
NameTypeDescription
$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoFeedThe 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
NameTypeDescription
$userstring

(optional) The username of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_PlaylistListFeedThe feed of playlists
methodpublicgetPlaylistVideoFeed(mixed $location) : \Zend_Gdata_YouTube_PlaylistVideoFeed

Retrieves a feed of videos in a particular playlist

Parameters
NameTypeDescription
$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_PlaylistVideoFeedThe feed of videos found at the specified URL.
methodpublicgetRecentlyFeaturedVideoFeed(mixed $location = null) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of recently featured videos.

Parameters
NameTypeDescription
$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoFeedThe 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
NameTypeDescription
$videoIdstring

The videoId of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoFeedThe 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
NameTypeDescription
$userstring

(optional) The username of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_SubscriptionListFeedThe feed of subscriptions
methodpublicgetTopRatedVideoFeed(mixed $location = null) : \Zend_Gdata_YouTube_CommentFeed

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

Parameters
NameTypeDescription
$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_CommentFeedThe 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
NameTypeDescription
$userstring

(optional) The username of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoFeedThe 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
NameTypeDescription
$userstring

(optional) The username of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_UserProfileEntryThe user profile entry
methodpublicgetUserUploads(string $user = null, mixed $location = null) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a user's uploads

Parameters
NameTypeDescription
$userstring

(optional) The username of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoFeedThe 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
NameTypeDescription
$videoIdstring

The videoId of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_CommentFeedThe 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
NameTypeDescription
$videoIdmixed

The ID of the video to retrieve.

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined.
$fullEntryboolean

(optional) Retrieve the full metadata for the

    entry. Only possible if entry belongs to currently authenticated
    user. An exception will be thrown otherwise.
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoEntryThe video entry found at the specified URL.
Throws
ExceptionDescription
\Zend_Gdata_App_HttpException
methodpublicgetVideoFeed(mixed $location = null) : \Zend_Gdata_YouTube_VideoFeed

Retrieves a feed of videos.

Parameters
NameTypeDescription
$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoFeedThe 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
NameTypeDescription
$videoIdstring

The videoId of interest

$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoFeedThe 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
NameTypeDescription
$locationmixed

(optional) The URL to query or a

    Zend_Gdata_Query object from which a URL can be determined
Returns
TypeDescription
\Zend_Gdata_YouTube_VideoFeedThe feed of videos found at the specified URL.
methodpublicparseFormUploadTokenResponse(string $response) : array
static

Helper function for parsing a YouTube token response

Parameters
NameTypeDescription
$responsestring

The service response

Returns
TypeDescription
arrayAn array containing the token and URL
Throws
ExceptionDescription
\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
NameTypeDescription
$commentEntry\Zend_Gdata_YouTube_CommentEntry

The comment entry to reply to

$commentTextstring

The text of the comment to post

Returns
TypeDescription
\Zend_Gdata_YouTube_CommentEntrythe posted comment
methodpublicsendVideoMessage(string $body,  $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
NameTypeDescription
$bodystring

The body of the message

$videoEntry
$videoIdstring

The id of the video to send

$recipientUserNamestring

The username of the recipient

Returns
TypeDescription
\Zend_Gdata_YouTube_InboxEntry | nullThe Zend_Gdata_YouTube_Inbox_Entry representing the sent message.
Throws
ExceptionDescription
\Zend_Gdata_App_InvalidArgumentExceptionif 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
NameTypeDescription
$client\Zend_Http_Client

The client to use for communication

$applicationId
$clientId
$developerKey
Returns
TypeDescription
\Zend_Gdata_AppProvides a fluent interface
Throws
ExceptionDescription
\Zend_Gdata_App_HttpException
Documentation was generated by phpDocumentor 2.2.0 .