KoljaWindeler / ytube_music_player

YouTube music player for homeassistant
345 stars 53 forks source link

bad request #364

Open bloasfist opened 2 weeks ago

bloasfist commented 2 weeks ago

Enable DEBUG Output Enabled it: 2024-11-03 12:28:53.923 ERROR (MainThread) [custom_components.ytube_music_player.media_player] Posting debug messages as error until restart

Describe the bug When opening ytubemediaplayer mediabrowser and browsing to any folder related to my youtube account (so all folders, except 'playback device' and 'current playlists'), it results in a dialogue titled 'media browsing error' with text 'unknown error'. Looking at the log it is probably because the component fails to launch (see log at time 12:29:38.295: (fail) TURNON) I've re-installed the component and integration (clearing cache and rebooting the machine) with same results.

2024-11-03 12:28:53.923 ERROR (MainThread) [custom_components.ytube_music_player.media_player] Posting debug messages as error until restart 2024-11-03 12:28:53.926 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [E] async_call_method 2024-11-03 12:29:38.286 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] TURNON 2024-11-03 12:29:38.287 ERROR (MainThread) [custom_components.ytube_music_player.media_player] playlists empty 2024-11-03 12:29:38.294 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] async_turn_off_media_player [E] 2024-11-03 12:29:38.295 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [E] (fail) TURNON 2024-11-03 12:29:41.745 ERROR (MainThread) [custom_components.ytube_music_player.media_player] async_browse_media 2024-11-03 12:29:41.746 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] async_check_api [E] 2024-11-03 12:29:43.070 ERROR (MainThread) [custom_components.ytube_music_player.media_player] async_browse_media 2024-11-03 12:29:43.070 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] async_check_api [E] 2024-11-03 12:29:43.148 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281473338639984] Error handling message: Unknown error (unknown_error) xxxx from xxx.xxx.xxx.xxx (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/media_player/init.py", line 1315, in websocket_browse_media payload = await player.async_browse_media(media_content_type, media_content_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ytube_music_player/media_player.py", line 2155, in async_browse_media response = await build_item_response(self, payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ytube_music_player/browse_media.py", line 93, in build_item_response media = await hass.async_add_executor_job(media_library.get_home, 20) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/ytmusicapi/mixins/browsing.py", line 115, in get_home response = self._send_request(endpoint, body) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/ytmusicapi/ytmusic.py", line 242, in _send_request raise YTMusicServerError(message + error) ytmusicapi.exceptions.YTMusicServerError: Server returned HTTP 400: Bad Request. Request contains an invalid argument.

Version 20241027.01

To Reproduce Steps to reproduce the behavior:

  1. Go to settings/devices/youtube music player
  2. In the controls tab, Click on 'ytube_music_player' (or whatever you've called it during installation)
  3. Hit browse media and select 'home' (or any other youtube music account related folder)
  4. Observe dialogue stating 'unknown error', look in log to see bad request / request contains an invalid argument error.

Any idea how to go from here? Thanks!!

bloasfist commented 2 weeks ago

I found a workaround; recreating the ytubemusic device and then using another google account for authentication. So, appearantly, my primary google account is the culprit; no idea why, youtube and youtube music apps on my phone work just fine...

stboch commented 1 week ago

@bloasfist Google is rolling out new changes to Youtube's encryption that is likely why one of the users is working. I have heard other users having issues with yt downloader and other youtube ad aversion products.

traqnski89 commented 1 week ago

Any permanent solution?

webmediart-github commented 6 days ago

Similar error here. Suddenly service calls from the past would not work any more.

Traceback (most recent call last): File "/config/custom_components/ytube_music_player/media_player.py", line 1136, in async_update_playlists self._playlists = await self.hass.async_add_executor_job(lambda: self._api.get_library_playlists(limit=self._trackLimit)) 

File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) 

File "/config/custom_components/ytube_music_player/media_player.py", line 1136, in <lambda> self._playlists = await self.hass.async_add_executor_job(lambda: self._api.get_library_playlists(limit=self._trackLimit)) 

File "/usr/local/lib/python3.12/site-packages/ytmusicapi/mixins/library.py", line 33, in get_library_playlists response = self._send_request(endpoint, body) 

File "/usr/local/lib/python3.12/site-packages/ytmusicapi/ytmusic.py", line 242, in _send_request raise YTMusicServerError(message + error) ytmusicapi.exceptions.YTMusicServerError: Server returned HTTP 400: Bad Request. Request contains an invalid argument.
Yonny24 commented 4 days ago

Missing my ytube player. Hope a solution can be found soon. Thanks!

lukaszwawrzyk commented 4 days ago

Would it be possible to just rollback to the previous approach with cookies to get things running again? Would it even work?

breeegz commented 4 days ago

After a few more rounds of "Why isn't this working?" than I care to admit, I am relieved that this seems to match up with my issues exactly.

YT Music has been in my corner ever since the death of Google Music (RIP), maybe it's time to let go and finally do the Spotify thing, unless this seems like a small hurdle. I'm hoping to get my Christmas Morning Automation working by Christmas and I need music.