acctman Posted March 21, 2012 Share Posted March 21, 2012 Does anyone know of a json or php method of authenticating a youtube user without using zend? <?php $id = NULL; $username = 'myYouTubeAccount'; $url = 'http://gdata.youtube.com/feeds/api/users/%s/uploads?orderby=updated&max-results=8'; $xml = simplexml_load_file(sprintf($url, $username)); foreach ($xml->entry as $entry) : $kids = $entry->children('http://search.yahoo.com/mrss/'); $attributes = $kids->group->content[0]->attributes(); $flv = $attributes['url']; $attributes = $kids->group->player->attributes(); $link = $attributes['url']; $querystring = parse_url($link,PHP_URL_QUERY); parse_str($querystring, $id_temp); $id = $id_temp['v']; ?> <a href="<?=$link?>"> <img src="http://i4.ytimg.com/vi/<?=$id?>/default.jpg" /> </a> <?php endforeach; ?> Link to comment https://forums.phpfreaks.com/topic/259430-authenticating-youtube-account/ Share on other sites More sharing options...
Mahngiel Posted March 21, 2012 Share Posted March 21, 2012 I use this: $youtubeID = 'some_user'; // set video data feed URL $feedURL = 'http://gdata.youtube.com/feeds/api/videos/' . $youtubeID; // read feed into SimpleXML object if( !$entry = simplexml_load_file($feedURL)) { // kick error } else { // run lib } Link to comment https://forums.phpfreaks.com/topic/259430-authenticating-youtube-account/#findComment-1329901 Share on other sites More sharing options...
acctman Posted March 21, 2012 Author Share Posted March 21, 2012 I use this: $youtubeID = 'some_user'; // set video data feed URL $feedURL = 'http://gdata.youtube.com/feeds/api/videos/' . $youtubeID; // read feed into SimpleXML object if( !$entry = simplexml_load_file($feedURL)) { // kick error } else { // run lib } this issue I'm having is that I have unlisted videos that do not show up on the feeds list. So I need to authenticate myself so I can grab the video ID's. Link to comment https://forums.phpfreaks.com/topic/259430-authenticating-youtube-account/#findComment-1329912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.