DIY YouTube TV
gotubecast is a small Go program which you can use to make your own YouTube TV player.
It connects to the YouTube Leanback API and generates a text stream providing pairing codes, video IDs,
play/pause/seek/volume change commands etc. It doesn’t have any dependencies and runs on any of the platforms supported by golang.
For example, use it on a Raspberry Pi in combination with youtube-dl and omxplayer for a DIY Chromecast clone or make a YouTube TV
extension for your favorite media center software.
Provided you have golang correctly set up:
go get cbix.de/gotubecast
With default options:
gotubecast
Minimal dumb YouTube TV example (opens every video in a new browser window, no control possible):
gotubecast -n "Dumb TV" -i dumb-v1 | while read line
do
cmd="`cut -d ' ' -f1 <<< "$line"`"
arg="`cut -d ' ' -f2 <<< "$line"`"
case "$cmd" in
pairing_code)
echo "Your pairing code: $arg"
;;
remote_join)
cut -d ' ' -f3- <<< "$line connected"
;;
video_id)
xdg-open "https://www.youtube.com/watch?v=$arg" &
;;
esac
done
Usage help:
$ gotubecast -h
Usage of ./gotubecast:
-d int
Debug information level. 0 = off; 1 = full cmd info; 2 = timestamp prefix, this changes the output format!
-i string
Display App (default "golang-test-838")
-n string
Display Name (default "Golang Test TV")
-s string
Screen ID (will be generated if empty)
More in the examples folder.
The following keys are being written to stdout: