https://github.com/ross/sonos-youtube
Trivial HTTP server to allow Sonos to play YouTube live streams
https://github.com/ross/sonos-youtube
Last synced: 7 months ago
JSON representation
Trivial HTTP server to allow Sonos to play YouTube live streams
- Host: GitHub
- URL: https://github.com/ross/sonos-youtube
- Owner: ross
- Created: 2023-11-01T22:36:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-21T02:39:40.000Z (almost 2 years ago)
- Last Synced: 2025-02-16T06:30:08.867Z (over 1 year ago)
- Language: Python
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Sonos YouTube
A trivial HTTP server to allow Sonos to play YouTube live streams.
Note: it does not currently work with non-streaming/regular videos, though it
may in the future.
### Running It
Works well running on devices like a NAS or even Raspberry PI
#### As a docker container
Recommended
```console
$ sudo ./script/update-docker
...
```
#### Stand-alone
If your setup dictates
```console
$ ./script/bootstram
$ ./script/run
```
### Using it
In the Sonos apps:
1. "Browse"
1. "TuneIn"
1. "My Radio Stations"
1. "..."
1. "Add New Radio Station"
1. "Streaming URL"
- Grab the ID portion of the URL you'd like to stream, in the case of `https://www.youtube.com/watch?v=jfKfPfyJRdk` that would be `jfKfPfyJRdk`
- `http://:9182/`, e.g. `http://my-nas.lan:9182/jfKfPfyJRdk`
1. "Station Name"
- Whatever you would like to call it, probably just a copy-n-paste of the stream's title
1. "OK"
You should now be able to play the live stream on your Sonos devices.
### How it works
One of the ways Youtube serves their videos an HLS Manifest, a `.m3u8` that happens to be supported by Sonos. However these URLs change over time so you can't just stick one into the "Streaming URL" field of a Sonos radio station. This simple server fetches the current data for the video and thend does a 302 redirect to the current URL. That's it.