summaryrefslogtreecommitdiffstats
path: root/firefox-youtube-handler
blob: 598ec56d999429affce9372e86d8ef5a142dcdc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

if ! tty; then
	exec 1<&-
fi

proto='yt://'
url=$1
id=${url##$proto}

audiourl="$(youtube-dl -g -f 141/140 -- "$id")"
videourl="$(youtube-dl -g -f 138/264/299/137/298/136/135/134 -- "$id")"
#audiourl="$(youtube-dl -g -f bestaudio -- "$id")"
#videourl="$(youtube-dl -g -f bestvideo -- "$id")"

#vlc "$videourl" --input-slave "$audiourl"
mpv --really-quiet --title "YouTube - $id" --no-cache --demuxer-lavf-o=fflags=+ignidx  "$videourl" --audio-file "$audiourl"
#mplayer "$videourl" -audiofile "$audiourl"

# max 720p because youtube serves 1080p only via DASH (seperate audio/video streams)
#urxvt -e bash -c "youtube-viewer -I \"http://youtube.com/watch?v=$id\"; sleep 5"
#smplayer "http://youtube.com/watch?v=$id"
#smplayer $(youtube-dl -g ${id})