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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
There are at least two ways to accomplish this:
The software intercepts the download streams and saves any videos it detects (this is the most likely scenario)
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...
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)
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)
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.
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.