Jump to content

Authenticating YouTube account?


acctman

Recommended Posts

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

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
}

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.