Media extractor
The Media extractor integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] gets a stream URL and sends it to a media player entity. This integration can extract entity specific streams if configured accordingly.
Media extractor doesn’t transcode streams, it just tries to find a stream that matches the requested query.
Configuration
To add the Media extractor integration to your Home Assistant instance, use this My button:
Manual configuration steps
If the above My button doesn’t work, you can also perform the following steps manually:
-
Browse to your Home Assistant instance.
-
In the bottom right corner, select the
Add Integration button. -
From the list, select Media extractor.
-
Follow the instructions on screen to complete the setup.
List of actions
The Media extractor integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] provides the following actions. Each link below opens a dedicated page with examples, parameters, and a step-by-step UI walkthrough.
-
Get media URL (
media_extractor.extract_media_url) Extracts a media URL and returns it in the action response. -
Play media (
media_extractor.play_media) Extracts a media URL and plays it on a media player.
For an overview of every action across all integrations, see the actions reference.
Format query
The query can be used to select the right media. Query examples with explanations:
- bestvideo: Best video-only stream
- best: Best video + audio stream
- bestaudio[ext=m4a]: Best audio stream in M4A format
- worst: Worst video + audio stream
- bestaudio[ext=m4a]/bestaudio[ext=ogg]/bestaudio: Best M4A audio, otherwise best OGG audio and only then any best audio
More info about queries can be found here.
Cookies
Some supported video services provide a better experience when you are logged in. For example, if you use Twitch Turbo or are subscribed to a Twitch streamer, logging in prevents the video stream from showing an “An ad is currently playing. Come back after the break.” message until the ad is over. Other examples are private or purchased YouTube videos which you can only watch while logged in. You can add a Netscape format cookie file in the Home Assistant configuration directory. The cookie file will be loaded each time a stream is loaded:
config/media_extractor/cookies.txt
To generate the cookie file, you can use a browser extension (like Get Cookies.txt LOCALLY). If you want to create one manually, follow this specification: https://curl.se/rfc/cookie_spec.html.