mopidy-youtube icon indicating copy to clipboard operation
mopidy-youtube copied to clipboard

Add support for high quality YouTube Music streams for Premium users.

Open ReneHollander opened this issue 3 years ago • 5 comments

This requires to supply yt-dlp with a cookiefile that exists on disk. The musicapi_cookie config option is replaced with a musicapi_cookiefile option. This also allows the cookies to be better protected by giving the file proper permissions or using Docker secrets in a Docker deployment.

Some nasty glue code is needed to generate a Cookie header from the CookieJar (There is no functionality in the Python stdlib to do this cleanly). A better approach would be to refactor all code to take a CookieJar opbject (including ytmusicapi) that can be natively used in requests and urllib (assuming it is used somewhere). As this requires some work on a dependency I am refraining from doing this in this PR.

ReneHollander avatar Jan 15 '22 23:01 ReneHollander

Thanks @ReneHollander - this is an interesting idea, and doesn't look too complicated. Appreciate you taking the time to submit. I'll have a look when I get a chance, and get back to you.

@sigma67 might be interested in a PR allowing ytmusicapi to take a Cookie Jar object, if that will make proper authentication from within the library easier (see https://github.com/sigma67/ytmusicapi/issues/10)?

natumbri avatar Jan 18 '22 10:01 natumbri

Sounds interesting, can you make a proposal for integrating this without breaking ytmusicapi for existing users?

Might be possible to pass cookiejar cookiefile as filepath and detect whether the file is json (current assumption) or a cookiejar, depending on the file type.

sigma67 avatar Jan 18 '22 12:01 sigma67

Thanks for the input! I will try to refactor the code to allow the usage of cookiejar. I hope I can get to it next week :)

ReneHollander avatar Jan 23 '22 20:01 ReneHollander

@ReneHollander any updates?

laur89 avatar Mar 09 '22 22:03 laur89

@laur89 sadly no. I didn't get to setup mopidy/snapcast yet, as it's impossible to order Raspberry Pis currently. So I didn't need this functionality and didn't spend time finishing it.

ReneHollander avatar Mar 11 '22 12:03 ReneHollander

This would be really cool to add if it's still possible. Mopidy-YTMusic has the ability to play high quality streams, but that plugin has a bunch of other issues that make this one better.

fatg3erman avatar Oct 06 '22 16:10 fatg3erman

Thanks @ReneHollander for the code, and @fatg3erman for the reminder. This seems to work ok, so I merged it. 256k audio unlocked.

natumbri avatar Oct 07 '22 05:10 natumbri

Uh oh; looks like it might not work completely yet - see #234

natumbri avatar Oct 07 '22 06:10 natumbri

Thanks for jumping on it so quickly. I'll try some tests in the next few days, missing playlists are not a thing I care about. If this works well I think I've found my Spotify replacement :)

fatg3erman avatar Oct 07 '22 08:10 fatg3erman