MPlayer youtube script: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 27: | Line 27: | ||
# The scipt above grabs the html source to the real stream (the .flv file), which # youtube constantly alters. The "http://www.youtube.com/get_video?video_id=" is # always the prefix -- and the script uses wget to d/l and append the rest of the # 'full' url (which is very long and stupid).. an ex.; | # The scipt above grabs the html source to the real stream (the .flv file), which # youtube constantly alters. The "http://www.youtube.com/get_video?video_id=" is # always the prefix -- and the script uses wget to d/l and append the rest of the # 'full' url (which is very long and stupid).. an ex.; | ||
#mplayer "http://www.youtube.com/get_video?video_id=L2SED6sewRw&l=2965&sk=GOT2L_qmpVJOx0wrud5ycdyuWziPg1lcC&fmt_map=6%2F720000%2F7%2F0%2F0&t=OEgsToPDskLlf4ls3xB6V84dMYLundws&hl=en&plid= | #mplayer "http://www.youtube.com/get_video?video_id=L2SED6sewRw&l=2965&sk=GOT2L_qmpVJOx0wrud5ycdyuWziPg1lcC&fmt_map=6%2F720000%2F7%2F0%2F0&t=OEgsToPDskLlf4ls3xB6V84dMYLundws&hl=en&plid=AARTXK76vCTnvQ5JAAAC6ADCAAA&sdetail=rv%253AL2SED6sewRw&tk=P4LgO65y-u5BllZJBsB_e2Gw-OVgaMp4a8prsHTahDhuPN_xsReW2Q%3D%3D&title=Greg Kroah | ||
Hartman on the Linux Kernel" | |||
# as you can see, there are blank spaces also that need to be cleaned up (blank # # spaces replaced with underscores). | # as you can see, there are blank spaces also that need to be cleaned up (blank # # spaces replaced with underscores). | ||
Revision as of 15:31, 15 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 if [ -z "$1" ]; then echo "No URL!" exit fi url=$1 shift echo \"http://www.youtube.com/get_video?video_id=`wget -q -O - $url | grep fullscreenUrl | awk -F'video_id=' '{ print $2 }' | sed -e 's/ /_/g' | tr -d \'\; `\" | xargs mplayer $* ### # The scipt above grabs the html source to the real stream (the .flv file), which # youtube constantly alters. The "http://www.youtube.com/get_video?video_id=" is # always the prefix -- and the script uses wget to d/l and append the rest of the # 'full' url (which is very long and stupid).. an ex.; #mplayer "http://www.youtube.com/get_video?video_id=L2SED6sewRw&l=2965&sk=GOT2L_qmpVJOx0wrud5ycdyuWziPg1lcC&fmt_map=6%2F720000%2F7%2F0%2F0&t=OEgsToPDskLlf4ls3xB6V84dMYLundws&hl=en&plid=AARTXK76vCTnvQ5JAAAC6ADCAAA&sdetail=rv%253AL2SED6sewRw&tk=P4LgO65y-u5BllZJBsB_e2Gw-OVgaMp4a8prsHTahDhuPN_xsReW2Q%3D%3D&title=Greg Kroah Hartman on the Linux Kernel" # as you can see, there are blank spaces also that need to be cleaned up (blank # # spaces replaced with underscores).
created by enouf and n3kl and amphi
RE-modified by enouf