Youtube Music - Media Browser

@leeb98 There should be a separate ‘search’ feature, you’re using the ‘filter’ function

Also try the incognito mode, I can’t get it to work when I’m not in incognito.
Jkw

edit:
@phreaq actually … my understanding was to use that “filter” but … hey… whatever works

So, big game_changer news, (I know that many are still working on ‘i need a header’ so this might not be sooo big), but:

I’ve rewritten the way how this component is retrieving the streaming URL:
Old: Take the videoId and let the pytube component find the URL (which failed very often for me, I’d guess because the YouTube music subscription videoId aren’t available from the web without login - which the pytub lib doesn’t have)
New: take only the descrambler algorithm from the pytube lib and use the extra info that we already have (from the ytmusicapi (ytmusicapi != pytube)). This is a) way faster and should b) way more reliant.

ah … and also the improved parser for the cookie (that is now stored in .storage/ytube_header.json) is also part of this commit.

Let me know if this works any better … JKW

1 Like

With this latest update, I was able to figure out what I was doing wrong!
( I did not see the updated README )

Instead of saying "Enter cookie text, copied from browser" - I think it might be more clear to say "Enter Requests Headers text, copied from browser"

thanks @phreaq , finally found it …

Ta

Lee

Tried the new release: It works so far.
I have my media player and I see all playlists.

Thanks for your engagement!

By the way: The media_player doesn’t start.
Do I have to write a script?

Hi Jörg, that’s good news. So the cookie works, otherwise the playlist wouldn’t be filled. All you should have to do is hit “on”. If that doesn’t work I’d assume that there is something wrong with you inputs. Did you copy everything from the readme (or the package) ? Have you checked the log? I think that It should spit out an error if it can’t find the inputs.
Did you add your Mediaplayer as shown in the readme?
Jkw

Hi,
I think, that I configured everythinf like described:
image

media_player:
  - platform: ytube_music_player
    # adapt the file location if needed. this has to match the file path that was
    # speicified in the config flow
    header_path: "/config/.storage/ytube_header.json"
    speakers:
      # if your speaker is called media_player.speaker123, add speaker123 here
      - office
      - unten
      - wohnzimmer
      - browser_s6_joerg

the media players are alexa echos

ytube_music_player_source:
  name: YouToube Source
  icon: mdi:music-box-multiple
  options: # don't change
    - "Playlist Radio"
    - "Playlist"
ytube_music_player_speakers:
  name: Speakers
  icon: mdi:speaker
  options: # don't change
    - "loading"
ytube_music_player_playlist:
  name: Playlist
  icon: mdi:playlist-music
  options: # don't change
    - "loading"

Looks good … I haven’t tested if this type of url works with alexa but I don’t see a reason why it wouldn’t. I guess you don’t see entries in the log, do you? Jkw

Edit: ok I’ve just setup my firetv stick via the Android TV integration. This isn’t working. The ytubemedia player calls the media_player.play_media service. Does that work for generic http urls, with your alexa? It does for all my chromecasts and google home but isn’t working with the fire tv.

Hi, I never tested it but as I learned from the alexa media forum, the guys there working with it quite intensive. So it should work. I for myself use alexa for notifications so far.

Have you seen this?
image
Didn’t you gave other release numbers?

Hi @Pirol62, there are no versions release numbers at this time.

The numbers you are seeing relate to the projects commits on GitHub

1 Like

getting the following error(s)

Ta

LeeB

Logger: homeassistant.helpers.integration_platform
Source: loader.py:429
First occurred: 10:30:24 PM (3 occurrences)
Last logged: 10:30:24 PM

Unexpected error importing ytube_music_player/logbook.py
Unexpected error importing ytube_music_player/group.py
Unexpected error importing ytube_music_player/system_health.py
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/integration_platform.py", line 30, in _process
    platform = integration.get_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 424, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 429, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.kaco.logbook'

running on docker …Synology DS918DS

config

- platform: ytube_music_player
    # adapt the file location if needed. this has to match the file path that was
    # speicified in the config flow
    header_path: "/config/.storage/ytube_header.json"
    speakers:
      # if your speaker is called media_player.speaker123, add speaker123 here
      - family_room_speaker

 ytube_music_player_source:
    name: Source
    icon: mdi:music-box-multiple
    options: # don't change
    - "Playlist Radio"
    - "Playlist"
  
  ytube_music_player_speakers:
    name: Speakers
    icon: mdi:speaker
    options: # don't change
    - "loading"

  ytube_music_player_playlist:
    name: Playlist
    icon: mdi:playlist-music
    options: # don't change
    - "loading"

Ok, that is super strange … Kaco is another integration that I wrote. I might have copied something from there but can’t find it. Did you clone the correct repository ? …

Has anybody realized, to play the music on an android device?
browser_mod does not work.
So there must be a way to create a media player which points to a local media service

I’m using https://github.com/KoljaWindeler/ytube_music_player.
And I only download zip

As per the instructions , it say create a folder called kaco…
I am doing this wrong ?

Lee

@leeb98 - It’s a typo, I think it should be

  1. In the custom_components directory (folder) create a new folder called ytube_music_player

Right, thanks for reporting and thanks to @troy for fixing it already
Jkw

Is there a shuffle mechanism/setting when playing playlist?

Yes, exactly the same as in the gmusic player from @troy. (Currently not documented) also same defaults and should be configurable in the same way (although I didn’t test)
Jkw