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.
Service class for interacting with the YouTube Data API.
STANDARD_RECENTLY_FEATURED_URI
= 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'
STANDARD_RECENTLY_FEATURED_URI_V2
= 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'
STANDARD_WATCH_ON_MOBILE_URI_V2
= 'https://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'
string
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
INBOX_FEED_URI
= 'https://gdata.youtube.com/feeds/api/users/default/inbox'The URI of the inbox feed for the currently authenticated user.
integer
ACTIVITY_FEED_MAX_USERS
= 20The maximum number of users for which activity can be requested for, as enforced by the API.

__construct(
\Zend_Http_Client $client
=
null, string $applicationId
=
'MyCompany-MyApp-1.0', string $clientId
=
null, string $developerKey
=
null
)
:
voidCreate Zend_Gdata_YouTube object
| 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 |

getActivityForUser(
$username
)
:
\Zend_Gdata_YouTube_ActivityFeedRetrieves the activity feed for users
| Name | Type | Description |
|---|---|---|
| $username |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_ActivityFeed |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_VersionException | if using version less than 2. |

getContactFeed(
string $user
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_ContactFeedRetrieves a feed of a user's contacts
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_ContactFeed | The feed of contacts |

getFormUploadToken(
\Zend_Gdata_YouTube_VideoEntry $videoEntry, string $url
=
'https://gdata.youtube.com/action/GetUploadToken'
)
:
arrayRetrieves a YouTube token
| Name | Type | Description |
|---|---|---|
| $videoEntry | \Zend_Gdata_YouTube_VideoEntry | The video entry |
| $url | string | The location as a string URL |
| Type | Description |
|---|---|
| array | An array containing a token and URL |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_Exception |

getFriendActivityForCurrentUser(
)
:
\Zend_Gdata_YouTube_ActivityFeedRetrieve the activity of the currently authenticated users friend.
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_ActivityFeed |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_Exception | if not logged in. |

getFullVideoEntry(
$videoId
)
:
\Zend_Gdata_YouTube_VideoEntry|nullRetrieves a video entry from the user's upload feed.
| Name | Type | Description |
|---|---|---|
| $videoId |
| 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. |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_HttpException |

getInboxFeedForCurrentUser(
)
:
\Zend_Gdata_YouTube_InboxFeed|nullRetrieve a feed of messages in the currently authenticated user's inbox.
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_InboxFeed|null |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_Exception | if not logged in. |

getMostViewedVideoFeed(
mixed $location
=
null
)
:
\Zend_Gdata_YouTube_VideoFeedRetrieves a feed of the most viewed videos.
| Name | Type | Description |
|---|---|---|
| $location | mixed | (optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoFeed | The feed of videos found at the specified URL. |

getPlaylistListFeed(
string $user
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_PlaylistListFeedRetrieves a feed which lists a user's playlist
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_PlaylistListFeed | The feed of playlists |

getPlaylistVideoFeed(
mixed $location
)
:
\Zend_Gdata_YouTube_PlaylistVideoFeedRetrieves a feed of videos in a particular playlist
| Name | Type | Description |
|---|---|---|
| $location | mixed | (optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_PlaylistVideoFeed | The feed of videos found at the specified URL. |

getRecentlyFeaturedVideoFeed(
mixed $location
=
null
)
:
\Zend_Gdata_YouTube_VideoFeedRetrieves a feed of recently featured videos.
| Name | Type | Description |
|---|---|---|
| $location | mixed | (optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoFeed | The feed of videos found at the specified URL. |

getRelatedVideoFeed(
string $videoId
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_VideoFeedRetrieves a feed of videos related to the specified video ID.
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoFeed | The feed of videos found at the specified URL. |

getSubscriptionFeed(
string $user
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_SubscriptionListFeedRetrieves a feed of a user's subscriptions
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_SubscriptionListFeed | The feed of subscriptions |

getTopRatedVideoFeed(
mixed $location
=
null
)
:
\Zend_Gdata_YouTube_CommentFeedRetrieves a feed of comments related to the specified video ID.
| Name | Type | Description |
|---|---|---|
| $location | mixed | (optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_CommentFeed | The feed of videos found at the specified URL. |

getUserFavorites(
string $user
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_VideoFeedRetrieves a user's favorites
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoFeed | The videos favorited by the user |

getUserProfile(
string $user
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_UserProfileEntryRetrieves a user's profile as an entry
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_UserProfileEntry | The user profile entry |

getUserUploads(
string $user
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_VideoFeedRetrieves a user's uploads
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoFeed | The videos uploaded by the user |

getVideoCommentFeed(
string $videoId
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_CommentFeedRetrieves a feed of comments related to the specified video ID.
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_CommentFeed | The feed of videos found at the specified URL. |

getVideoEntry(
mixed $videoId
=
null, mixed $location
=
null, boolean $fullEntry
=
false
)
:
\Zend_Gdata_YouTube_VideoEntryRetrieves a specific video entry.
| 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. |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoEntry | The video entry found at the specified URL. |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_HttpException |

getVideoFeed(
mixed $location
=
null
)
:
\Zend_Gdata_YouTube_VideoFeedRetrieves a feed of videos.
| Name | Type | Description |
|---|---|---|
| $location | mixed | (optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoFeed | The feed of videos found at the specified URL. |

getVideoResponseFeed(
string $videoId
=
null, mixed $location
=
null
)
:
\Zend_Gdata_YouTube_VideoFeedRetrieves a feed of video responses related to the specified video ID.
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoFeed | The feed of videos found at the specified URL. |

getWatchOnMobileVideoFeed(
mixed $location
=
null
)
:
\Zend_Gdata_YouTube_VideoFeedRetrieves a feed of videos recently featured for mobile devices.
These videos will have RTSP links in the $entry->mediaGroup->content
| Name | Type | Description |
|---|---|---|
| $location | mixed | (optional) The URL to query or a Zend_Gdata_Query object from which a URL can be determined |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_VideoFeed | The feed of videos found at the specified URL. |

parseFormUploadTokenResponse(
string $response
)
:
arrayHelper function for parsing a YouTube token response
| Name | Type | Description |
|---|---|---|
| $response | string | The service response |
| Type | Description |
|---|---|
| array | An array containing the token and URL |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_Exception |

replyToCommentEntry(
\Zend_Gdata_YouTube_CommentEntry $commentEntry, string $commentText
)
:
\Zend_Gdata_YouTube_CommentEntryPost a comment in reply to an existing comment
| Name | Type | Description |
|---|---|---|
| $commentEntry | \Zend_Gdata_YouTube_CommentEntry | The comment entry to reply to |
| $commentText | string | The text of the comment to post |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_CommentEntry | the posted comment |

sendVideoMessage(
string $body, \Zend_Gdata_YouTube_VideoEntry $videoEntry
=
null, string $videoId
=
null, string $recipientUserName
)
:
\Zend_Gdata_YouTube_InboxEntry|nullSend a video message.
Note: Either a Zend_Gdata_YouTube_VideoEntry or a valid video ID must be provided.
| 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 |
| Type | Description |
|---|---|
| \Zend_Gdata_YouTube_InboxEntry|null | The Zend_Gdata_YouTube_Inbox_Entry representing the sent message. |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_InvalidArgumentException | if no valid Zend_Gdata_YouTube_VideoEntry or videoId were provided |

setHttpClient(
\Zend_Http_Client $client, $applicationId
=
'MyCompany-MyApp-1.0', $clientId
=
null, $developerKey
=
null
)
:
\Zend_Gdata_AppSet the Zend_Http_Client object used for communication
| Name | Type | Description |
|---|---|---|
| $client | \Zend_Http_Client | The client to use for communication |
| $applicationId | ||
| $clientId | ||
| $developerKey |
| Type | Description |
|---|---|
| \Zend_Gdata_App | Provides a fluent interface |
| Exception | Description |
|---|---|
| \Zend_Gdata_App_HttpException |