How I browse and watch youtube

5 replies [Last post]
Joined: 04/21/2016

There are 2 options that I use to watch youtube

1.- Our friend JadedCtrl has a collection of (pretty POSIX) shell scripts to browse YouTube quickly, efficiently, and without the bloat most command-line clients require.

Also, shellTube doesn't use the YouTube API at all. This avoids the annoying red-tapey stuff that goes with it -- IDs, registration, quota.

(yeah I pretty much copypaste the description :P her words are better than mine though )

2.- I also use this GUI client called Kaku some videos some times not work though, but I think it is related to youtube limiting some videos (a couple months back a few applications like VLC, youtube-dl and new pipe broke because of changes on youtube)

So that is what I mostly use. Any comments and advice would be appreciated. In virtue of the recent problems with youtube-dl I thought this might help.

hack and hack
Joined: 04/02/2015

Kaku uses json, which doesn't mean a thing yet, but might be the same problem youtube-dl has.
Shelltube looks good, but a bit complicated (to me).

What about using wget? A simple script from these principles might be all it takes:

Well, at least for downloading, but not for streaming. Maybe this kind of script would be enough:

I just now modified my script to stream videos, and it just works using vlc + URL that I get from the browser with xclip. What *might* be problematic is the lack of video quality choice, but for streaming, I don't care at all. EDIT:
In this specific case, youtube-dl was just an unnecessary step. But hey, I'm no programmer.

Now for download, It should work (gotta test) if expanding the script to tacke what's in the link above into account. Again, I have no idea if I can make a video quality choice, even if I never had to for now.

I'm a genius. Actually, not just yet :p
it works with youtube (basically it's vlc + URL), but not dailymotion for example (whereas youtube-dl does).
Ah, explanation here:
Unfortunately, for now it works only with youtube. But it seems faster and more reliable.

Joined: 04/21/2016

Los of edits :) lol

Let me try it

hack and hack
Joined: 04/02/2015

Sure, here it is:
xclip -selection clipboard blank
xdotool key --clearmodifiers F6
var=$(xclip -o)
#vlc $(youtube-dl --prefer-free-formats -g $var)
vlc $var
I kept the line with youtube-dl commented for illustration, though I used the clearmodifiers line twice in a row with it.
I just have the script linked to a keyboard shortcut.
The only obligation is to have the browser and the page active (selected).

Way too much edits ^^"
OK, one more EDIT, while I'm at it:
even on youtube, some videos don't work. it seems it's because the URL is super long.
So it's not really good enough yet :7

Aaaand I just found a (not tested) workaround :D
(though in the lua file, there's something called js_url, so maybe it's still not a solution.

Well, at least the lua parser works, if updated:

But then I'd neet other lua files for other websites.
Got it for dailymotion (just find dailymotion.lua, and put it in /usr/lib/vlc/lua/playlist/

Magic Banana

I am a member!

Joined: 07/24/2010

See (and maybe contribute to) for different solutions, which are not restricted to YouTube.

hack and hack
Joined: 04/02/2015

Good idea, and it does work better than Viewtube for me.
The only interrogation is, do the .lua files lead to JS execution? I can't find that js_url thing anywhere:

-- Descramble the URL signature using the javascript code that does that
-- in the web page
function js_descramble( sig, js_url )
-- Fetch javascript code
local js = { stream = js_url ), lines = {}, i = 0 }

It seems there's also a local URL descrambler:

It seems youtube-dl uses that too:

Else, catching the URL of the script with F6 and xclip and xdotool is still a bit tricky. Sometimes I have to try twice. but it's still less keystrokes than copying and pasting.

My own conclusion (based on my limited skills and research):
Viewtube is the safest, but doesn't work even with all youtube videos (I just tried with one).
Both using vlc with updated lua scripts and youtube-dl seem to be executing a short bit of js code from the web page that akes the URL readable.
Not sure for vlc, but it seems it does.
youtube-dl accesses more websites.

From there, it's up to each user: having a crippled access to the web, but fully safe,
or allowing some bit of JS from the webpage, which most likely isn't harmful
(at worst, it can steal data/install spyware, and this can be countered by sandboxing in theory).

Tough choices.