by renekooi · 12y ago · 0 comments
ytplay() { youtube-dl "$1" -o - | vlc - }
As a side benefit it of course also allows you to instantly watch stuff from all the other sites YT-DL supports :) ytplay() { youtube-dl "$1" -o - | vlc -; }
but works great! ytplay() { youtube-dl "$1" -o - | vlc - ; }
or: ytplay() { youtube-dl "$1" -o - | vlc - #<enter here>
> } #Where "> " is bash prompting for more/end of definitoin
In a file (eg: .bashrc), I'd personally prefer: ytplay() {
youtube-dl "${1}" -o - | vlc -
}
Note that there's very little difference between "$1" and "${1}" in practice, I tend to prefer it for consistency with recommended[1] practice of using ${NAME} rather than $NAME. (And to differentiate something like "${1}${2}" vs "${12}", as you might if $1 was a name, and $2 an extension, or $1 and url-scheme and $2 a host-name (http://hostname -> "${1}${2}" 1="http://" 2="hostname").[1] http://stackoverflow.com/questions/8748831/bash-why-do-we-ne...
youtube-dl --get-url "$1" | xargs mplayerIf not, please share me a YT link.