6

Sites were you put in a youtube url, then it goes and gives you an mp4 or mp3 of the video.

How does that work?

Viewing the source of a youtube page gives me:

 <video class="video-stream html5-main-video" x-webkit-airplay="allow" data-youtube-id="q9ioaNWaqtw" src="blob:http%3A//www.youtube.com/9a45c6e4-df42-4e8b-9fb3-43a78cccebf3" style="width: 640px; height: 360px; left: 0px; top: 0px; -webkit-transform: none;"></video>

Just going to the src gives you nothing. As an answer, oliver says you can just "simply download them directly". How do those sites do that?

I'm planning to make one. What pieces of information, specifically, should I be targeting?

Is there any sort of open source youtube downloader I can take a look at?

0

2 Answers 2

2

YouTube download websites determine the location of the FLV file that is served through the YouTube player. It essentially reverse engineers the HTML/JavaScript (previously Flash/ActionScript) that serves the video and gets the source.

It then prompts your browser to start downloading that FLV file, or it converts it in the cloud for you to download in the format you want. All of this is being done with VBScript or Visual Basic and Java.

The reason you can't view the source file in the page's source code is because YouTube doesn't serve the file in plaintext HTML, it does it using the video player on the backend.

5
  • Can you be more specific? I'm planning to make one. What pieces of information, specifically, should I be targeting?
    – user229061
    Commented Oct 14, 2013 at 17:19
  • 1
    OWiz, doing so is a direct violation of Youtube's Terms of Use: youtube.com/static?gl=CA&template=terms Commented Oct 14, 2013 at 17:23
  • @ChrisInEdmonton I figured.
    – user229061
    Commented Oct 14, 2013 at 17:40
  • 1
    But can I get to the URL by disabling the HTML5 player and reverting to the Flash player at youtube.com/html5?
    – gparyani
    Commented Oct 14, 2013 at 17:42
  • @OWiz I take it you're doing this in VBScript? That's how all the online ones are doing it on the backend. There are plenty of tutorials I found for "creating youtube downloaders in Visual Basic"
    – user201262
    Commented Oct 14, 2013 at 17:48
0

The files are on YouTubes servers. They are just streamed to your client. You could just as well simply download them directly.

The only difference with these sites is, that they're also serving you advertisements.

3
  • AFAIK, there is no url that you can simply go to and have a video download to your computer, as opposed to going to a url and downloading your OpenID avatar. The files appear to be somewhat protected from "just downloading them"
    – user229061
    Commented Oct 14, 2013 at 17:11
  • 2
    @OWiz: There are several browser extensions and userscripts out there that implement this "feature". You can just look at their source code and see how it works. There is nothing special about it. Commented Oct 14, 2013 at 17:39
  • 1
    Oh, it never occurred to me to simply look at the source of one of those things. Thanks
    – user229061
    Commented Oct 14, 2013 at 17:41