Does anyone here know how youtube-dl works internally ? Can anyone Just explain how youtube-dl is able to download the videos of Safari books because I want to know how it operates so that I can make video downloader for many other sites which uses .m3u8 or streams .
If you’re wondering to download then this article can help you.
how it works and how to make one, I will check and solve it if possible.
No i wanted to download it through paython script programmatically just like youtube-dl does. Although youtube-dl is open source but i am terrible at reading someone else’s code to be fair .
Really ? like really , did you even read what i am asking ?
YoutubeDL.extract_info is a good place to start; it checks a provided URL against the extractors (from the
extractor package) that are known, each of which has site-specific rules for extracting content URLs from a web page.
Once an extractor returns a URL and other metadata, it eventually calls
downloader.get_suitable_downloader on the content URL provided by the extractor to determine what protocol to use when downloading. The implementation for each protocol extends
FileDownloader which provides the general interface for downloading a file.
Depending on the requested options, it may need to postprocess downloaded files, for instance remuxing the requested video and audio tracks into one file. Code for doing these things is in the
For reference, if you can build something like this from scratch!
Python to Download YouTube Videos with a Tkinter UI
Can you take example of YouTube or twitter and demonstrate how to go about because when I see the video source of the video tag , it is like blob:https://YouTube.com/some_hash_code and same goes for twitter. If a site has video pointing directly to a video source then it’s easy to download but like I said YouTube Twitter and many other site have stream type of video.
I have been one of its contributors. basically when you give an url, the corresponding extractor is called. That will parse the url’s html, get required details, such as id, name of the video, timestamp, video id, likes/upvotes, etc. Generally, everything isn’t needed, but a few are absolutely needed, such as id and video id/url. That info is passed to downloader, that actually downloads the video. Furthen, post processing is done as per needed. The extractor also handles logins, which in some cases is complexed. Many sites use encoding, such as HLS, which is much more difficult to parse. The folks @ ytdl are very smart and make a new contributor writing code for a new extractor using hls/ any other encoding as easy as possible.
So how do they extract download link of hls encoded video because they are very tough to extract. if possible take the example of any twitter video and explain. Because twitter also uses hls encoding.
There’s a lot to explain. Take a look @ https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/downloader/hls.py . The code is beautifully written easy to understand.