Youtube vedio upload problem

3 messages Options
Embed this post
Permalink
phpbrat

Youtube vedio upload problem

Reply Threaded More More options
Print post
Permalink
Hi ,

I m getting the error when i m uploading the vedio to youtube server using the code below

Error is    Invalid developer key
              Error 403


Though im able to fetch user data using the same developer key !!

code is below

try {
            $httpClient = Zend_Gdata_ClientLogin::getHttpClient(
                                          $username = 'aa',
                                          $password = 'pass',
                                          $service = 'youtube',
                                          $client = null,
                                          $source = 'ddd', // a short string identifying your application
                                          $loginToken = null,
                                          $loginCaptcha = null,
                                          'https://www.google.com/youtube/accounts/ClientLogin');
        } catch (Zend_Gdata_App_AuthException $ae) {
           echo 'eror';
        }
                                // Note that this example creates an unversioned service object.
                // You do not need to specify a version number to upload content
                // since the upload behavior is the same for all API versions.
                $yt = new Zend_Gdata_YouTube($httpClient,$clientId,
                                                                                                $applicationId,
                                                                                                $clientId,
                                                                                                $developerKey);
                if(!$yt){
                        echo 'ohh.. no objekt !!';
                }

                // create a new VideoEntry object
                $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();

                // create a new Zend_Gdata_App_MediaFileSource object
                $path = 'C:\upload\vedio.avi';
               
                $filesource = $yt->newMediaFileSource($path);
                $filesource->setContentType('video/avi');
                // set slug header
                $filesource->setSlug($path);

                // add the filesource to the video entry
                $myVideoEntry->setMediaSource($filesource);

                $myVideoEntry->setVideoTitle('My Test Movie');
                $myVideoEntry->setVideoDescription('My Test Movie');
                // The category must be a valid YouTube category!
                $myVideoEntry->setVideoCategory('Autos');

                // Set keywords. Please note that this must be a comma-separated string
                // and that individual keywords cannot contain whitespace
                $myVideoEntry->SetVideoTags('cars, funny');

                // set some developer tags -- this is optional
                // (see Searching by Developer Tags for more details)
                $myVideoEntry->setVideoDeveloperTags(array('mydevtag', 'anotherdevtag'));

                // set the video's location -- this is also optional
                $yt->registerPackage('Zend_Gdata_Geo');
                $yt->registerPackage('Zend_Gdata_Geo_Extension');
                $where = $yt->newGeoRssWhere();
                $position = $yt->newGmlPos('37.0 -122.0');
                $where->point = $yt->newGmlPoint($position);
                $myVideoEntry->setWhere($where);

                // upload URI for the currently authenticated user
                $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/users/default/uploads';

                // try to upload the video, catching a Zend_Gdata_App_HttpException,
                // if available, or just a regular Zend_Gdata_App_Exception otherwise
                try {
                  $newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
                } catch (Zend_Gdata_App_HttpException $httpException) {
                  echo 'UPLOAD FAIL'.$httpException->getRawResponseBody();
                } catch (Zend_Gdata_App_Exception $e) {
                        echo 'UPLOAD second FAIL'.$e->getMessage();
                }

plz help here if i gone somewhere wrong

Thanks in advance
brat
Jochen Hartmann

Re: Youtube vedio upload problem

Reply Threaded More More options
Print post
Permalink
Hi,

The error that you are getting is because you are either not
specifying a developer key or the developer key that you are
specifying is incorrect. Please make sure that you have signed up for
a key at this link:

http://code.google.com/apis/youtube/dashboard/

Cheers,
- jochen

On Wed, Mar 18, 2009 at 6:42 AM, phpbrat <[hidden email]> wrote:

>
> Hi ,
>
> I m getting the error when i m uploading the vedio to youtube server using
> the code below
>
> Error is    Invalid developer key
>              Error 403
>
>
> Though im able to fetch user data using the same developer key !!
>
> code is below
>
> try {
>            $httpClient = Zend_Gdata_ClientLogin::getHttpClient(
>                                          $username = 'aa',
>                                          $password = 'pass',
>                                          $service = 'youtube',
>                                          $client = null,
>                                          $source = 'ddd', // a short string
> identifying your application
>                                          $loginToken = null,
>                                          $loginCaptcha = null,
>
> 'https://www.google.com/youtube/accounts/ClientLogin');
>        } catch (Zend_Gdata_App_AuthException $ae) {
>           echo 'eror';
>        }
>                                // Note that this example creates an unversioned service object.
>                // You do not need to specify a version number to upload content
>                // since the upload behavior is the same for all API versions.
>                $yt = new Zend_Gdata_YouTube($httpClient,$clientId,
>                                                                                                $applicationId,
>                                                                                                $clientId,
>                                                                                                $developerKey);
>                if(!$yt){
>                        echo 'ohh.. no objekt !!';
>                }
>
>                // create a new VideoEntry object
>                $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
>
>                // create a new Zend_Gdata_App_MediaFileSource object
>                $path = 'C:\upload\vedio.avi';
>
>                $filesource = $yt->newMediaFileSource($path);
>                $filesource->setContentType('video/avi');
>                // set slug header
>                $filesource->setSlug($path);
>
>                // add the filesource to the video entry
>                $myVideoEntry->setMediaSource($filesource);
>
>                $myVideoEntry->setVideoTitle('My Test Movie');
>                $myVideoEntry->setVideoDescription('My Test Movie');
>                // The category must be a valid YouTube category!
>                $myVideoEntry->setVideoCategory('Autos');
>
>                // Set keywords. Please note that this must be a comma-separated string
>                // and that individual keywords cannot contain whitespace
>                $myVideoEntry->SetVideoTags('cars, funny');
>
>                // set some developer tags -- this is optional
>                // (see Searching by Developer Tags for more details)
>                $myVideoEntry->setVideoDeveloperTags(array('mydevtag', 'anotherdevtag'));
>
>                // set the video's location -- this is also optional
>                $yt->registerPackage('Zend_Gdata_Geo');
>                $yt->registerPackage('Zend_Gdata_Geo_Extension');
>                $where = $yt->newGeoRssWhere();
>                $position = $yt->newGmlPos('37.0 -122.0');
>                $where->point = $yt->newGmlPoint($position);
>                $myVideoEntry->setWhere($where);
>
>                // upload URI for the currently authenticated user
>                $uploadUrl =
> 'http://uploads.gdata.youtube.com/feeds/users/default/uploads';
>
>                // try to upload the video, catching a Zend_Gdata_App_HttpException,
>                // if available, or just a regular Zend_Gdata_App_Exception otherwise
>                try {
>                  $newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl,
> 'Zend_Gdata_YouTube_VideoEntry');
>                } catch (Zend_Gdata_App_HttpException $httpException) {
>                  echo 'UPLOAD FAIL'.$httpException->getRawResponseBody();
>                } catch (Zend_Gdata_App_Exception $e) {
>                        echo 'UPLOAD second FAIL'.$e->getMessage();
>                }
>
> plz help here if i gone somewhere wrong
>
> Thanks in advance
> brat
> --
> View this message in context: http://www.nabble.com/Youtube-vedio-upload-problem-tp22579153p22579153.html
> Sent from the Zend gdata mailing list archive at Nabble.com.
>
>
Jochen Hartmann

Re: Youtube vedio upload problem

Reply Threaded More More options
Print post
Permalink
In reply to this post by phpbrat
Hi,

The error that you are getting is because you are either not
specifying a developer key or the developer key that you are
specifying is incorrect. Please make sure that you have signed up for
a key at this link:

http://code.google.com/apis/youtube/dashboard/

Cheers,
- jochen

On Wed, Mar 18, 2009 at 6:42 AM, phpbrat <[hidden email]> wrote:

>
> Hi ,
>
> I m getting the error when i m uploading the vedio to youtube server using
> the code below
>
> Error is    Invalid developer key
>              Error 403
>
>
> Though im able to fetch user data using the same developer key !!
>
> code is below
>
> try {
>            $httpClient = Zend_Gdata_ClientLogin::getHttpClient(
>                                          $username = 'aa',
>                                          $password = 'pass',
>                                          $service = 'youtube',
>                                          $client = null,
>                                          $source = 'ddd', // a short string
> identifying your application
>                                          $loginToken = null,
>                                          $loginCaptcha = null,
>
> 'https://www.google.com/youtube/accounts/ClientLogin');
>        } catch (Zend_Gdata_App_AuthException $ae) {
>           echo 'eror';
>        }
>                                // Note that this example creates an unversioned service object.
>                // You do not need to specify a version number to upload content
>                // since the upload behavior is the same for all API versions.
>                $yt = new Zend_Gdata_YouTube($httpClient,$clientId,
>                                                                                                $applicationId,
>                                                                                                $clientId,
>                                                                                                $developerKey);
>                if(!$yt){
>                        echo 'ohh.. no objekt !!';
>                }
>
>                // create a new VideoEntry object
>                $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
>
>                // create a new Zend_Gdata_App_MediaFileSource object
>                $path = 'C:\upload\vedio.avi';
>
>                $filesource = $yt->newMediaFileSource($path);
>                $filesource->setContentType('video/avi');
>                // set slug header
>                $filesource->setSlug($path);
>
>                // add the filesource to the video entry
>                $myVideoEntry->setMediaSource($filesource);
>
>                $myVideoEntry->setVideoTitle('My Test Movie');
>                $myVideoEntry->setVideoDescription('My Test Movie');
>                // The category must be a valid YouTube category!
>                $myVideoEntry->setVideoCategory('Autos');
>
>                // Set keywords. Please note that this must be a comma-separated string
>                // and that individual keywords cannot contain whitespace
>                $myVideoEntry->SetVideoTags('cars, funny');
>
>                // set some developer tags -- this is optional
>                // (see Searching by Developer Tags for more details)
>                $myVideoEntry->setVideoDeveloperTags(array('mydevtag', 'anotherdevtag'));
>
>                // set the video's location -- this is also optional
>                $yt->registerPackage('Zend_Gdata_Geo');
>                $yt->registerPackage('Zend_Gdata_Geo_Extension');
>                $where = $yt->newGeoRssWhere();
>                $position = $yt->newGmlPos('37.0 -122.0');
>                $where->point = $yt->newGmlPoint($position);
>                $myVideoEntry->setWhere($where);
>
>                // upload URI for the currently authenticated user
>                $uploadUrl =
> 'http://uploads.gdata.youtube.com/feeds/users/default/uploads';
>
>                // try to upload the video, catching a Zend_Gdata_App_HttpException,
>                // if available, or just a regular Zend_Gdata_App_Exception otherwise
>                try {
>                  $newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl,
> 'Zend_Gdata_YouTube_VideoEntry');
>                } catch (Zend_Gdata_App_HttpException $httpException) {
>                  echo 'UPLOAD FAIL'.$httpException->getRawResponseBody();
>                } catch (Zend_Gdata_App_Exception $e) {
>                        echo 'UPLOAD second FAIL'.$e->getMessage();
>                }
>
> plz help here if i gone somewhere wrong
>
> Thanks in advance
> brat
> --
> View this message in context: http://www.nabble.com/Youtube-vedio-upload-problem-tp22579153p22579153.html
> Sent from the Zend gdata mailing list archive at Nabble.com.
>
>