I use Firefox and the Video DownloadHelper plugin to download videos from YouTube, etc.

How do these plugins and sites automatically obtain download links for these videos?


There are at least two ways to accomplish this:

  1. The software intercepts the download streams and saves any videos it detects (this is the most likely scenario)

  2. The software simply copies it out of the web brower's cache (although not impossible, this is far less likely for two reasons: 1., requires specific knowledge of all supported web browsers and possibly also certain video players; and 2., not all videos are stored on disk in their entirety as this depends on the video player)

    Edit: Added third and fourth possibilities...

  3. The software requests the video by crafting the same download request as the viewer plug-in would, and then saves the data as it is received (this is different from the first possibility I listed above, and it may require some reverse-engineering of the movie players written in Flash or some packet sniffing to determine how the URI was actually constructed)

  4. The software replaces the default handler for video players (or it may replace the Flash Player handler and act as an interim handler on web sites it recognizes such as YouTube.com, Video.Google.com, etc., but for web sites and Flash Animation content it doesn't specifically recognize it just passes the work off to the previous Flash Player plug-in to create a more "transparent" effect for the user)

| improve this answer | |
  • Yes, I know this, but I wanted some more detailed information about the first way. i.e How exactly does the software identify a video stream, how does it intercept the stream etc. – Ankit Soni Aug 8 '11 at 7:21
  • I'm not sure how you would intercept a video stream like that without using a proxy, which I don't think those downloaders do. Another way to do it would be to use information from the page to locate the actual video files and download them directly. See raw.github.com/rg3/youtube-dl/2011.08.04/youtube-dl for more. – user55325 Aug 8 '11 at 7:44
  • @user55325: The same way packet sniffing software would do it. – Randolf Richardson Aug 8 '11 at 7:50
  • Doesn't that usually need to hook directly into your network drivers? Certainly it's not how youtube-dl does it; it seems like that would be overkill somehow. – user55325 Aug 8 '11 at 8:12
  • @user55325: Well, I described "at least two ways" -- I'm not particularly sure how "youtube-dl" (which I assume is the name of one of these "video grabbing" applications) gets the video, but at least you now know of two possible methods. Hooking into the network drivers probably isn't needed, as Windows likely provides a higher-level API that is more generic and doesn't require NIC-specific hooks. – Randolf Richardson Aug 9 '11 at 2:17

YouTube has a unique URL for each video. Some sites offer an online script that converts YouTube videos into MP4 or similar video file extension. That script usually downloads the video to their FFMPEG server and then converts it into MP4 or any other supported format and lets you download that streaming video.

| improve this answer | |
  • regarding conversion, are you referring to the free ffmpeg software when you say ffmpeg server? I don't know of it having a server option – barlop Aug 8 '11 at 13:28
  • The video is normally stored as a .FLV formatted file which can be natively played by the excellent free and open source VLC Player: videolan.org – Randolf Richardson Aug 9 '11 at 2:13
  • @barlop, server uses script for the conversion. There are plenty of free and paid scripts that do this type of conversion. Most of these scripts started as an alternative clone script for youtube. – Ryu Sep 5 '11 at 21:36
  • @Ryu I've never tried it just reading a bit now but I guess you mean things that started off as a clone of the youtube website , / video sharing website scripts, video hosting and sharing solutions, server-side flv converter, like this package youtube-clone.com Interesting. I see ffmpeg includes streaming so may be able to, there is such a thing as an ffmpeg server, as you say, so kind of see what you're getting at. I hadn't encountered it before. – barlop Sep 5 '11 at 21:49
  • WinCAP driver is used on windows servers and desktop for the stream capturing. You can google "URL snooper" for how streams can be captured with this driver on windows desktop. Similarly there are FFMPEG servers which are prepared to handle media content like flv files, java and media files. – Ryu Sep 5 '11 at 21:53

There is a tool called youtube-dl that does this by extracting all the necessary information about the video file and its location, and then downloading it (either via RTMPDump or directly) according to the user's specification (many YouTube videos are available in multiple formats).

Python source is available and should run on Linux, Windows, and Mac OS X (provided the Python interpreter is installed).

I would think this is how most of the downloaders work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.