Tuesday, February 28, 2012

[YouTube-API] Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 403 yt:quotatoo_many_recent_calls'

getting
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with
message 'Expected response code 200, got 403
yt:quotatoo_many_recent_calls'

I was testing sunday and ran this code muultiple times, but none since
then. Any help would be appreciated.

code is below
$username = $get_config->yt_username;
$password = $get_config->yt_password;
$developerKey = $get_config->yt_developerKey;


Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
//$yt = new Zend_Gdata_YouTube();

$authenticationURL= 'https://www.google.com/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = $username,
$password = $password,
$service = 'youtube',
$client = null,
$source = 'MySource',
// a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);


$developerKey = $developerKey;
$applicationId = 'Video uploader v1';
$clientId = '';
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId,
$developerKey);

$newPlaylist = $yt->newPlaylistListEntry();
$newPlaylist->summary = $yt->newDescription()->setText('Triathlon
Workout Playlist');
$newPlaylist->title = $yt->newTitle()->setText($playlistName);
//$thePlaylistId = $yt->playlistId;
//echo "<br />the playlist id is $thePlaylistId <br />";
// post the new playlist
$postLocation = 'http://gdata.youtube.com/feeds/api/users/wearitliveit/
playlists';
try {
$yt->insertEntry($newPlaylist, $postLocation);
echo"Playlist Created <br />";
//$playlistUrl=$newPlaylist->getTitleValue();
//echo"Playlist URL is $playlistUrl";
}
catch
(Zend_Gdata_App_Exception $e)
{
echo $e->getMessage();
}


$query = $yt->newVideoQuery();

$query->videoQuery = 'triathlon';

$query->startIndex = 10;
$query->maxResults = 20;
$query->orderBy = 'viewCount';
echo "<br />Query URL: " . $query->queryUrl . "\n<br />";
$videoFeed = $yt->getVideoFeed($query);

foreach ($videoFeed as $videoEntry) {

$feed = $yt->getPlaylistListFeed('default');

foreach ($feed as $playlistListEntry) {

$postUrl = $playlistListEntry->getPlaylistVideoFeedUrl();
$videoEntryToAdd = $yt->getVideoEntry( $videoEntry->getVideoId() );

// create a new Zend_Gdata_PlaylistListEntry, passing in the underling
DOMElement of the VideoEntry
$newPlaylistListEntry = $yt->newPlaylistListEntry($videoEntryToAdd-
>getDOM());

// post
try {
$yt->insertEntry($newPlaylistListEntry, $postUrl);
} catch (Zend_App_Exception $e) {
echo $e->getMessage();
}


}// end foreach feed

$playlistListFeed = $yt->getPlaylistListFeed('wearitliveit');

foreach ($playlistListFeed as $playlistEntry) {

echo $playlistEntry->title->text . "\n<br />";

echo $playlistEntry->description->text . "\n<br />";

if ( $playlistEntry->title->text == "$playlistName" ) {

$the_video_id = $playlistEntry->getPlaylistVideoFeedUrl();

echo "$the_video_id</br />";

$this->echoPlaylist($the_video_id);

}

}

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment