infantdeveloper / ytks-downloader

Unofficial Downloader for https://ytks.app
17 stars 0 forks source link

youtube-dl cannot extract nsig jsi, player_id, func_codefunction code due to YouTube API update #10

Closed Speyedr closed 1 month ago

Speyedr commented 1 month ago

Likely due to changes on YouTube's end, the current version of youtube-dl (used to acquire the video and audio streams) can no longer extract the information necessary to complete a download.

While the youtube-dl app recommends running an update, this does not (currently) fix the issue. This is because the pip package is no longer updated. The latest version for this package is 2021.12.17, whereas the current ytdl-nightly release is at version 2024.07.11, which has recently received an nsig update which presumably fixes the bug. However, I couldn't find an official pip package for the nightly builds. In fact, the repo hosting these builds explicitly claims that "These nightly releases are not available through package managers like brew."

I believe that the easiest solution to this problem that requires the least amount of changes is to switch to a fork of youtube-dl known as yt-dlp which is significantly more robust. It has a pip package and as far as I'm aware the only change necessary would be to import the new module, as the components of the yt-dlp fork that are used by this project have the exact same shape.

Speyedr commented 1 month ago

Note: A peer of mine has pointed out that yt-dlp supports downloading "1080p (Premium)" quality video streams, and so if the video has such a quality setting, it will pass the protected stream to FFmpeg, which will of course fail to download it because it doesn't know how to.

This would also need to be somehow addressed, either by figuring out how to download the protected stream using FFmpeg, or preventing yt-dlp from returning the Premium quality video stream. It should be noted that the stream ID for 1080p Premium is 616.

infantdeveloper commented 1 month ago

Thank you for the extensive description and research!

I've updated the project to use yt-dlp instead of youtube-dl as you suggested and excluded all video formats tagged as premium. Check out the changes here

Feel free to reopen this thread if any of the issues remain unresolved

Speyedr commented 1 month ago

Seems to be working on my end now, thank you very much!