Play the most recent video of an Youtube Channel with a script on a Chromecast

Recently were wondering if I could play the most reason youtube video of an channel without the hussle to take out my Phone. Getting out the content ID was cind of a struggle, First via the API, then with a scrape sensor and now at last (maybe not least) with an command line sensor (@Ludeeus came up with this <3 grateful i am meme )

  - platform: command_line
    name: yt_Franck
    command: curl -sSL | grep videoId | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
    scan_interval: 6000

  - platform: command_line
    name: yt_Franck_title
    command: curl -sSL | grep title | head -n 2 | cut -d '>' -f 2 | cut -d '<' -f 1 | tail -1
    scan_interval: 6000


    - service: media_extractor.play_media
      entity_id: media_player.kffowi202_2
        media_content_id: "{{ states('sensor.yt_franck') }}"
        media_content_type: video/youtube

Lovelace card : 
  - cards:
      - entity: script.bad_franck
          action: none
        name: Franck
          action: call-service
          service: script.bad_franck
        type: entity-button
    type: horizontal-stack
  - cards:
       - entity: sensor.yt_franck_title
         type: sensor
         name: 'Lastest  Show:'
    type: horizontal-stack
type: vertical-stack

When you need help to find a channel ID :

started to create a costom sensor… But I cant code… yet :wink:
Maybe someone would like to create a proper sensor?
you can get an API key >here<

Look for this later today @Underknowledge
:soon: :slight_smile:


I moved and published it here :slight_smile:

1 Like

I know it’s a year ago - but does this custom component still work? Could HACS maybe have an user example page where user screenshots could be added - github readme is quite short. Or could HACS get a user voting part with the options: Working or Not Working.