fe80Grau / ytdlp2STRM

A little script to serve Youtube / Twitch / Crunchyroll videos without storage it. Uses yt-dlp HTTP data throught Flask and dynamic URLs. We can use this dynamic URLs to set STRM files.
https://github.com/fe80Grau/ytdlp2STRM
MIT License
206 stars 19 forks source link

So, how exactly should jellyfin+youtube integration work? #79

Open lesf0 opened 1 week ago

lesf0 commented 1 week ago

I've experienced an issue (#78) with youtube not allowing to get video data without an authorization, so I've started poking around and found a possible solution: https://github.com/coletdjnz/yt-dlp-youtube-oauth2 I managed to integrate it to ytdlp2STRM so it started to work for me, but then I've encountered a few weird playback issues:

So, a few questions:

P.S. If you're interested, I will gladly submit all my work on integrating yt-dlp-youtube-oauth to your repo once I'll figure it out and tie some ends (e.g. add it to configuration file and show authentification code in admin panel).

fe80Grau commented 1 week ago

Hi, the integration you are doing with oauth2 seems very interesting, it would be great to be able to review your code, maybe you could publish it in your fork of ytdlp2strm?

I think I know what the problem is. In my code, cookies (or cookies-from-browser) are currently used only when requesting the final manifest of a video from YouTube, using the direct() function of the youtube.py file. Within this you can see the call to set_cookies on line 762, but I am not adding it to the commands to obtain the list of videos from a channel. You can review it above in the code in the same file within the Youtube class. I will work to include cookies in all yt-dlp commands. If we can also include your integration with oauth2, even better.

I think that all the problems would be solved with this. The redirection is handled automatically by youtube when the manifest is accessed, ytdlp2strm checks if there are no cookies set for age-restricted videos then it is not possible to get the hls manifest and only in that case it uses the command to get the final webm or mp4 url ​​but this is only available in low resolution. You can also check this in the direct() function

With the necessary context I answer your questions