Is there a way to get the HLS URL for YouTube live streams like this one https://www.youtube.com/embed/WVZpCdHq3Qg
I've tried the typical get_video_info methods as well as a paid service (http://ytapi.gitnol.com/) but they don't seem to work with live streams.
Yes this is possibleSince the question is update, this solution can only gives you the embed url not the HLS url, check @JAL answer. with the ressourcesearch.list
and the parameters:Request :
Result:
Then get the
videoID
value WVZpCdHq3Qg for example and add the value to this url:You need to get the HLS m3u8 playlist files from the video's manifest. There are ways to do this by hand, but for simplicity I'll be using the youtube-dl tool to get this information. I'll be using this live stream as an example: https://www.youtube.com/watch?v=_Gtc-GtLlTk
First, get the formats of the video:
In this case, there are two videos because the live stream contains two cameras. From here, we need to get the HLS URL for a specific stream. Use
-f
to pass in the format you would like to watch, and-g
to get that stream's URL:These are your HLS m3u8 playlists, one for each camera associated with the live stream.
Without youtube-dl, your flow might look like this:
Take your video id and make a GET request to the
get_video_info
endpoint:In the response, the
hlsvp
value will be the link to the m3u8 HLS playlist:This URL return to player actual video_id
Where UCkA21M22vGK9GtAvq3DvSlA is your channel id. You can find it inside YouTube account on "My Channel" link.