utubify (390B)
1 #!/bin/sh 2 # 3 # Simple script to use youtube-dl for all youtube links 4 # and your browser of choice otherwise 5 6 export LINK=$@ 7 8 if [ -z ${LINK} ]; then 9 echo "usage: $0 <link>" 10 exit 1 11 fi 12 13 echo ${LINK} | grep -ie "https\?://\(\(\(www.\)\?youtube.com/.*\(?v=\|&v=\).\+\)\|\(youtu.be/.\+\)\)" 14 if [ $? -eq 0 ]; then 15 urxvt -e sh -c 'mplayer $(youtube-dl -g ${LINK})' & 16 else 17 chromium ${LINK} & 18 fi