Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL to get the video file or stream from YouTube?

Tags:

youtube

This url returns a huge html page which is for watching the video.

http://www.youtube.com/watch?v=some_id

I can't go through all the HTML tags and get the right url to the actual video. I believe there is a url from where the actual video stream is coming. I expect it to be something like,

http://www.youtube.com/get_the_video?id=some_id
Or,
http://www.youtube.com/get_the_video/some_id.mp4

I can't find any information about the correct url for the video.

Is this how YouTube maintain it's video link or their is something else?

Do they always change the url?

I want to do something like this in HTML to play the video.

<video width="320" height="240" controls autoplay>
        <source src="http://www.youtube.com/get_the_video?id=some_id" type="video/mp4">
</video>

(I am new to how YouTube works. Need some guidance)

like image 250
Mawia Avatar asked Jul 18 '13 09:07

Mawia


1 Answers

You can use youtube-dl to download or get the stream url from YouTube.

to download a video,

youtube-dl http://www.youtube.com/watch?v=some_id

or

youtube-dl some_id

to get the stream url, do

youtube-dl -g http://www.youtube.com/watch?v=some_id

Basically the url is parsed from the html source code of the original page.

like image 105
Jun Avatar answered Sep 19 '22 17:09

Jun