You are not logged in.

#1 2013-08-10 15:34:29

Konstantin_hu
Banned
Registered: 2012-05-14
Posts: 84
Website

Is there any CLI command to listen youtube videos?

I often listen to cabarets, stand-up comedies, music  from youtube. The video is usually a still picture. Is there any resource saving CLI utility (similar to mpg123, which I use to listening mp3 streaming radio stations) which can play youtube videos but only the sound?

Offline

#2 2013-08-10 15:57:41

teckk
Member
Registered: 2013-02-21
Posts: 590

Re: Is there any CLI command to listen youtube videos?

Install youtube-dl and mplayer.

#! /usr/bin/env bash

echo "Enter URL"
while read URL
do
mplayer -cookies -cookies-file /tmp/cookies.txt $(youtube-dl -f 18 -g --cookies /tmp/cookie.txt "$URL")
done

Or for no video somwthing like.

#! /usr/bin/env bash

echo "Enter URL"
while read URL
do
mplayer -novideo -cookies -cookies-file /tmp/cookies.txt $(youtube-dl -f 18 -g --cookies /tmp/cookie.txt "$URL")
done

Or if you don't like mplayer then modify the shell scripts to your liking.

Offline

#3 2013-08-10 15:59:30

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Is there any CLI command to listen youtube videos?

It's against the YT ToS, but you can use e.g. mpv or some other app using quvi.

Offline

#4 2013-08-10 16:35:53

teckk
Member
Registered: 2013-02-21
Posts: 590

Re: Is there any CLI command to listen youtube videos?

Ok, I never thought about that.
Youtube is available for desktop and portable devices to view, it's open to the public. The only thing one is cutting out with youtube-dl is the use of flash. Flash doesn't work on some devices and html video doesn't work on some browsers like Dillo. When one is using a browser with flash one can choose video size and type to view. Scripts do the same thing, even accepting their cookies. I don't see how that's harming youtube but I'll keep youtube's ToS in mind for the forums sake.

Offline

#5 2013-08-10 16:49:34

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Is there any CLI command to listen youtube videos?

I think they get money from the adds and they may gather a lot of data e.g. that most people skip the first two minutes of a show, listen only 3/4 of it etc.
I never uploaded anything to YT, but if such info is available to uploaders, it can help them too.

YT's ToS don't say "if your preferred way of web browsing makes it hard / impossible to use YT, you can just download stuff", so I guess they want you to use a "YT-compatible" browser. In other words: it's your problem, not theirs.



It's possible to download a video from YT via a CLI utility, browser plugin or in some other way and then use 'mplayer -novideo' or something similar to listen to the material. This gives you extra control, you can e.g. speed it up or view some parts of it frame-by-frame.

Offline

Board footer

Powered by FluxBB