The embed URL for a channel\'s live stream is:
https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID
and it works but if I want to e
You could get the video ID using PHP like this:
getMessage();
}
// The method which finds the video ID
function getLiveVideoID($channelId)
{
$videoId = null;
// Fetch the livestream page
if($data = file_get_contents('https://www.youtube.com/embed/live_stream?channel='.$channelId))
{
// Find the video ID in there
if(preg_match('/\'VIDEO_ID\': \"(.*?)\"/', $data, $matches))
$videoId = $matches[1];
else
throw new Exception('Couldn\'t find video ID');
}
else
throw new Exception('Couldn\'t fetch data');
return $videoId;
}