music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.39k stars 51 forks source link

YTmusic playback fails "get_throttling_function_name: could not find match for multiple" #2622

Closed hundredfire closed 4 months ago

hundredfire commented 4 months ago

What version of Music Assistant has the issue?

2.0.7

What version of the Home Assistant Integration have you got installed?

2024.6.2

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

When trying to play any music from youtube music, an error pops-up with the message "get_throttling_function_name: could not find match for multiple"

How to reproduce

Try playing a track or playlist or album

Music Providers

youtube music

Player Providers

Chromecast speaker

Full log output

log.txt

Additional information

No response

What version of Home Assistant Core are your running

2024.7.2

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Raspberry Pi

hundredfire commented 4 months ago

Found a relevant bug report upstream on pytube's repo: pytube issue 1750 They propose a working solution:

In cipher.py locate:

    r'a\.[a-zA-Z]\s*&&\s*\([a-z]\s*=\s*a\.get\("n"\)\)\s*&&.*?\|\|\s*([a-z]+)',
    r'\([a-z]\s*=\s*([a-zA-Z0-9$]+)(\[\d+\])?\([a-z]\)',

And replace by:

    r'a\.[a-zA-Z]\s*&&\s*\([a-z]\s*=\s*a\.get\("n"\)\)\s*&&.*?\|\|\s*([a-z]+)',
    r'\([a-z]\s*=\s*([a-zA-Z0-9$]+)(\[\d+\])\([a-z]\)',

And they also suggest transitioning to pytubefix, although this might introduce breaking changes (I haven't read much about this one)

MarvinSchenkel commented 4 months ago

The good news is that I completely rewritten the code that relies on pytube and replaced it with something much more stable. The bad news is that it'll be included in 2.1, so you'll have to wait for the release. We're in the final stages of testing so it shouldn't be too far away

wildoracle commented 4 months ago

THANK YOU! This setup is way more stable than YTubeMusic Player was which was way better than Google's own app for Google speakers. 🤯

lukasgarcya commented 4 months ago

Is this code in any branch?

marcelveldt commented 4 months ago

Is this code in any branch?

It's included in the 2.1.0rc3

OzGav commented 4 months ago

@hundredfire please confirm this has been fixed in 2.1.0rc3

hundredfire commented 4 months ago

Hello! I can confirm everything works in 2.1.0rc3. Great work. Thank you very much

On a possibly unrelated note, does this new implementation as alternative of pytube uses significantly more resource? I had some issues after trying to install the beta version. HAOS became totally unresponsive on my raspberry pi 4B and I had to do a full wipe to test it on a brand new installation. I was using an old microSD card tbh, so this might be completely unrelated. (I've reinstalled on an SSD and am restoring from backups now)