News for hackers. Stuff that matters.
Re:Youtube-dl by renekooi on Sunday November 23, 2014 @05:27AM (#8648354)
YT videos lag a lot when I stream them directly in VLC 2.2.0, (`vlc <youtube link>`) and some protected videos don't play at all, so I often use this:

    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 :)
Re:Youtube-dl by jboynyc on Sunday November 23, 2014 @06:10AM (#8648441)
That's a great idea. I use Livestreamer for that purpose.

https://pypi.python.org/pypi/livestreamer/1.10.2

Re:Youtube-dl by relate on Sunday November 23, 2014 @10:42AM (#8649014)
Had to add a colon:

    ytplay() { youtube-dl "$1" -o - | vlc -; }
but works great!
Re:Youtube-dl by wrboyce on Sunday November 23, 2014 @12:51PM (#8649332)
That is a semicolon, and it shouldn't be necessary (at least not in bash/zsh).
Re:Youtube-dl by heinrich5991 on Sunday November 23, 2014 @05:11PM (#8650137)
I believe it's necessary, otherwise the closing bracket counts as parameter to the last command.
Re:Youtube-dl by e12e on Sunday November 23, 2014 @10:49PM (#8650977)
Correct. On the command line:

    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...

Re:Youtube-dl by unicornporn on Sunday November 23, 2014 @06:55PM (#8650422)
May I ask what the program "ytplay" is? Google doesn't guide me.
Re:Youtube-dl by skeletonjelly on Sunday November 23, 2014 @07:23PM (#8650489)
It's a function name that renekooi would have made up to run the command following it without having to type it all out every time.
Re:Youtube-dl by pritambaral on Sunday November 23, 2014 @07:26PM (#8650495)
That's how you define a function in Bash.
Re:Youtube-dl by girvo on Sunday November 23, 2014 @08:48AM (#8648784)
Holy heck that's a great idea. Thanks!
Re:Youtube-dl by quoiquoi on Monday November 24, 2014 @08:28AM (#8652245)
I use xargs

    youtube-dl --get-url "$1" | xargs mplayer
Re:Youtube-dl by jbk on Sunday November 23, 2014 @12:01PM (#8649196)
I think I fixed the "some protected videos" last week.

If not, please share me a YT link.