View Single Post
Old 5th January 2014
yei0K yei0K is offline
New User
 
Join Date: Jan 2014
Posts: 1
Default

I have the "youtube-dl", "zenity" and "vlc" packages installed and I am using a keyboard shortcut, "Mod4-y", that runs the following script:

Code:
#!/bin/sh

xterm -e 'youtube-dl --no-part -f 18/0/h264-sd -o $HOME/video.vid `zenity --entry` & \
sleep 8 && vlc -f $HOME/video.vid vlc://quit; \
mv $HOME/video.vid $HOME/video.vid.old; \
pkill -n xterm & ksh'
To watch a YouTube video, I copy the URL to the clipboard, press "Mod4-y", paste the URL into the dialog, the video begins to download and after 8 seconds, vlc streams the video in fullscreen.

I've set up youtube-dl to download videos in medium quality for youtube, liveleak and vimeo ("18" selects medium quality for youtube, "0" for liveleak and "h264-sd" for vimeo). If you want to choose a better quality, run "youtube-dl -F URL" and replace "18/0/h264-sd" with your choices.

"youtube-dl --list-extractors" gives you a full list of supported sites.

There certainly are better ways to do this. Also, this script can be dangerous, because the last line always kills the last opened xterm (which should be the xterm the script runs in, but you may leave the video open to watch it later). This is no problem for me, as I am always running tmux on top of xterm, so if the wrong xterm is killed, I just have to reattach tmux.

Last edited by yei0K; 5th January 2014 at 12:54 PM.
Reply With Quote