Youtube Music - Media Browser

It decodes the streaming url from youtube … that’s surprisingly complicated

media player demon or so … google is your friend

yes you need to have the media_player available in homeassistant

yep, thats not all that clear … I might add something to the readme, thanks
JKW

1 Like

Thanks for all the info, ill look into it.

Added kodi as an integration, i can control it through HA (play/pause movies etc) but selecting it as a media player in ytube does not do anything.

Kodi is on a ftv, could it be what you mentioned above that’s causing the issue?

Or does this apply solely to ftv as a player?

Never tried, but i have a ftv and will give it a try

I tried to stream to alexa devices through alexa_media_player.

I get a TTS anouncement that “sorry text to speech can only be called with the notify.alexa_media service, please see the alexa_media wiki for details”

Just to get this out of the way :slight_smile:

alexa’s even via the alexa_media_player service doesn’t support playing media by URL.

Ftv + KODi with proxy works here

could you, or ideally multiple people checkout ytube_music_player/README.md at main · KoljaWindeler/ytube_music_player · GitHub
I’ve added videotutorials to show the complete process. Installation, mini_media_player shortcuts, dropdowns

Nice addon! Does this work with non Premium account? I get the following error when try to play on the browser:

Failed to call service media_player/play_media. not a valid value for dictionary value @ data['entity_id']

that has nothing to do with the integration … that’s “just” the regular homeassistant service syntax …
e.g.

- service: media_player.play_media
    data:
      entity_id: media_player.ytube_music_player
      media_content_id: PL6H6TfFpYvpersEdHECeWkocaPueTqieF
      media_content_type: playlist

you have to provide a entity_id … which is really what the error already told you …

Ah okay thanks, so I need to define a default entity_id via Integrations, but I will still be able select a source using dropdowns, (i.e via browser)?

Correct, and you can also change the output by calling the select_source service… e.g. here towards the Mediaplayer Carlo

See also https://github.com/KoljaWindeler/ytube_music_player#services

1 Like

I had a power outage yesterday and since rebooting my HA system I received the below error:
image

2021-03-17 19:05:01 ERROR (SyncWorker_12) [custom_components.ytube_music_player.const] The entered information has the correct format, but returned an error 403 (access forbidden). You don't have access with this data (anymore?). Please update the cookie

I tried a restart but got the same error.

I’m sure I can follow what it says and update the cookie, but why would this have happened? I have performed many restarts recently to update HA etc, but never had this issue.

Same happened to me after a restart of my router. I could imagine that it had something to do with my external IP?

honestly: no idea. Cookies have a limited lifetime :man_shrugging:

Jkw

Fair enough. Thanks for the awesome component :+1:

1 Like

Anyone has an idea how I could scrobble the tracks to lastfm with this player?

I’m getting old. I had to Google what scobble is :wink:

… No …

I hope someone here can help
I have been using this media player for 2 months with no issues.
Last week, the drop down option for Playlist radio stopped working with the following error output:

2021-03-23 07:44:05 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] TURNON
2021-03-23 07:44:05 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] play_media, media_type: channel, media_id: LM
2021-03-23 07:44:05 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] prepare_play
2021-03-23 07:44:05 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] check_api
2021-03-23 07:44:05 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] - no valid API, try to login
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] - YouTube Api initialized ok, version: 0.14.3
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] _update_remote_player
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] _turn_on_media_player
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] _get_cipher
2021-03-23 07:44:06 ERROR (SyncWorker_15) [custom_components.ytube_music_player.media_player] _sync_player
2021-03-23 07:44:06 ERROR (SyncWorker_15) [custom_components.ytube_music_player.media_player] media_player.shield: off -> idle
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] get_playlist(playlistId=LM) … get_watch_playlist(videoId=eDB4ULCHCAE)
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player]
============= ytube_music_player Integration Error ================
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] unfortunately we hit an error in the sub api, please open a ticket at
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] https://github.com/sigma67/ytmusicapi/issues
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] and paste the following output:
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] Traceback (most recent call last):
File “/config/custom_components/ytube_music_player/media_player.py”, line 1124, in play_media
self._tracks = self._api.get_watch_playlist(videoId=r_track[‘videoId’])[‘tracks’]
File “/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/watch.py”, line 80, in get_watch_playlist
tracks = parse_watch_playlist(results[‘contents’])
File “/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/watch.py”, line 29, in parse_watch_playlist
‘playlistId’: nav(data, NAVIGATION_PLAYLIST_ID),
File “/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py”, line 210, in nav
raise err
File “/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py”, line 204, in nav
root = root[k]
KeyError: ‘playlistId’
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player]
thanks, Kolja
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] ============= ytube_music_player Integration Error ================
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] turn_off
2021-03-23 07:44:06 ERROR (SyncWorker_17) [custom_components.ytube_music_player.media_player] _turn_off_media_player
2021-03-23 07:44:06 ERROR (Thread-14) [homeassistant.components.cast.media_player] Failed to cast media https://www.home-assistant.io/images/cast/splash.png. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
2021-03-23 07:44:06 ERROR (SyncWorker_8) [custom_components.ytube_music_player.media_player] _sync_player
2021-03-23 07:44:06 ERROR (SyncWorker_8) [custom_components.ytube_music_player.media_player] media_player.shield: idle -> idle
2021-03-23 07:44:06 ERROR (SyncWorker_20) [custom_components.ytube_music_player.media_player] _sync_player
2021-03-23 07:44:06 ERROR (SyncWorker_20) [custom_components.ytube_music_player.media_player] media_player.shield: idle -> off

the author of the ytmusicapi released a new update I dont know how to implement it with this addon. Can someone please help me with this.
Thanks

Hi, Just to copy from GitHub: if you have issues with the radio please update to the latest version in hacs.
Jkw