Skip to content

Instantly share code, notes, and snippets.

@lemming
Created January 25, 2011 18:53
Show Gist options
  • Save lemming/795404 to your computer and use it in GitHub Desktop.
Save lemming/795404 to your computer and use it in GitHub Desktop.
function youtube-play() {
if [ $# -eq 1 ]; then
YOUTUBE_LINK=$1
else
YOUTUBE_LINK=`xclip -o -selection "clipboard" | grep -oE 'http[^&]*' | head -n1`
fi
YOUTUBE_COOKIES=$HOME/.youtube.cookies
if [ ! -e $YOUTUBE_COOKIES ]; then
curl -c $YOUTUBE_COOKIES http://www.youtube.com > /dev/null 2>&1
fi
mplayer -cache 8192 -cookies -cookies-file $YOUTUBE_COOKIES `youtube-dl -g --cookies $YOUTUBE_COOKIES --max-quality=22 $YOUTUBE_LINK`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment