php - Youtube API v2 - Authentication differs between queries? -


using youtube api, i'm trying write script listing of uncaptioned videos user owns, whether public, private, or unlisted. first, authenticate using user's credentials:

require_once 'zend/loader.php'; // zend dir must in include_path zend_loader::loadclass('zend_gdata_youtube'); zend_loader::loadclass('zend_gdata_clientlogin');  try {     $httpclient = zend_gdata_clientlogin::gethttpclient(     $username = $youtube_login["username"],     $password = $youtube_login["password"],     $service = 'youtube',     $client = null,     $source = 'name', // short string identifying application     $logintoken = null,     $logincaptcha = null,     $authenticationurl);     $yt = new zend_gdata_youtube($httpclient, $applicationid, $clientid, $developerkey); } catch ( exception $e ) {     $err[] = $e->getmessage();     return false; } 

then, try return list in 2 ways. first try use query pull uncaptioned videos database:

try{     $query = $yt->newvideoquery();     $query->setparam('caption', 'false');     $query->setparam('author', $youtube_login["username"]);     $query->orderby = 'viewcount';     $videofeed = $yt->getvideofeed($query); } catch (zend_gdata_app_exception $e) {     $err[] = $e->getmessage();     end_script(false); } 

however, private , unlisted videos missing results. second attempt, use getuseruploads() function pull videos, , check them missing captions:

try{     $videofeed = $yt->getuseruploads($youtube_login["username"]); } catch (zend_gdata_app_exception $e) {     $err[] = $e->getmessage();     end_script(false); }  foreach ($videofeed $videoentry) {     foreach ($videoentry->link $link) {         if($link->rel == "http://gdata.youtube.com/schemas/2007#video.captiontracks"){             if($link->extensionattributes['http://gdata.youtube.com/schemas/2007:hasentries']['value'] == 'false'){                 // video has no caption entries, print entry info             }         }     } } 

this returns me correct result, @ cost of efficiency, speed, , data transfer. since there's data transfer google allows per day, , since amount of videos large (and increasing), subpar solution.

is there way correctly authenticate first attempt, in order find unpublished , unlisted videos client needs listed? or, way entirely not involve downloading , traversing entire list of videos?

thank you!

update:

i've discussed employer, , oauth not option, 2 or 3 legged.

so, there absolutely no way @ authenticate newvideoquery() function? purposefully hindered unable retrieve video's personal data, video owner?

use oauth authentication process. more secure , end token can use instead of repeating auth process each time.

https://developers.google.com/youtube/2.0/developers_guide_protocol_oauth2


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -