Downloading videos from YouTube can be a complex task due to the platform’s restrictions designed to protect its revenue from ad views. In this article, the author explains the technical details of YouTube’s security measures and how they can be bypassed. The process involves finding the video’s URL using the YouTube API and then transforming a parameter called “n” using a JavaScript algorithm found in the base.js file. The throttling rule implemented by YouTube can be overcome by breaking the download into smaller segments using the HTTP Range header. Finally, the video and audio channels are combined using ffmpeg. This technique is used by projects like yt-dlp, VLC media player, and NewPipe to enable video downloads from YouTube.
https://blog.0x7d0.dev/history/how-they-bypass-youtube-video-download-throttling/