How to Get all video from youtube channel

Posted by engineerisaac


Posted on 1 month ago

Here is a simple and easy way to get all the channels from a youtube account.



Your first step will be to acquire a youtube API key. Found https://console.cloud.google.com/apis/credentials At this link.



You then can use this PHP code

Script:






//https://console.cloud.google.com/apis/credentials



$grab_username = 'Insert_Username-HERE';

$google_key ='Insert-Key-HERE';



// Get the string from the URL

$json = file_get_contents('https://www.googleapis.com/youtube/v3/channels?key='. $google_key .'&forUsername='. $grab_username .'&part=id');



// Decode the JSON string into an object

$obj = json_decode($json);



// In the case of this input, do key and array lookups to get the values

echo $obj->items[0]->id;



$grab_id = $obj->items[0]->id;





$videoList = json_decode(file_get_contents('https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&channelId='. $grab_id .'&maxResults=20&key='. $google_key .''));





foreach($videoList->items as $item){

//Embed video

if(isset($item->id->videoId)){

echo '

id->videoId.'" frameborder="0" allowfullscreen>

'. $item->snippet->title .'

';

}

}










Guests Cannot Post!

If you would like to Comment on this video! Consider joining the Blue community!

Register Login


Other Engineerisaac Articles