MPlayer youtube script: Difference between revisions
Jump to navigation
Jump to search
(distinguish between http url and other options) |
(simplify url test) |
||
Line 16: | Line 16: | ||
URL="$1" | URL="$1" | ||
if [ "$URL | if [ "${URL#http://}" = "$URL" ] | ||
then | then | ||
echo "usage: $0 <youtube-URL> [mplayer args ...]" | echo "usage: $0 <youtube-URL> [mplayer args ...]" |
Revision as of 03:34, 14 August 2008
bash script for playing youtube videos
- save it as youtube.sh
- chmod +x youtube.sh
- place it somewhere in PATH (like /usr/local/bin )
Usage:
- youtube.sh <url> [mplayer args]
- youtube.sh http://www.youtube.com/watch?v=example -dumpstream -dumpfile something.flv
- youtube.sh http://www.youtube.com/watch?v=example -aspect 16:9
- youtube.sh http://www.youtube.com/watch?v=example -xy 2
#!/bin/bash URL="$1" if [ "${URL#http://}" = "$URL" ] then echo "usage: $0 <youtube-URL> [mplayer args ...]" exit fi shift echo \"http://www.youtube.com/get_video?video_id=$(wget -q -O - "$URL" \ | sed -e '/fullscreenUrl/!d' \ -e "s/.*video_id=\([^']*\).*/\1/" \ -e 's/ /_/g' \ )\" \ | xargs mplayer "$@"
created by enouf and n3kl and amphi
modified by Elte