播放分128k/300k/clips,播放比率输入750k下载,下载保存在~/Mydownload/;如果不当时下载,地址保存到~/Mydownload/download.list;播放过程中按q,退出播放,继续下一个地址,Ctrl+C退出。
代码: #!/bin/sh # 这个脚本用来播放北京宽带网视频花园的在线电影 # 方法很菜,但是我还是很有成就感的 ^_^ # 请高手不吝赐教! play_clips() { wget $page_addr -O temp_file grep clips temp_file|tr '"' '\n'|grep clips|awk -F"'" '{print $2}'|awk \ 'BEGIN{bbn="http://media.bbn.com.cn/zxyy/"}{print bbn""$0}'>temp_file2; \ rm temp_file wget `cat temp_file2` -O temp_file3;rm temp_file2 cat temp_file3|grep SRC|tr '"' '\n'|grep http>temp_file4;rm temp_file3 wget `cat temp_file4` -O temp_file5;rm temp_file4 cat temp_file5|grep http if [ $? = 0 ] then cat temp_file5|tr '"' '\n'|grep http>clips_list;rm temp_file5 mplayer -playlist clips_list;rm clips_list else cat temp_file5|tr '"' '\n'|grep rtsp>clips_list;rm temp_file5 mplayer -playlist clips_list;rm clips_list fi } echo "===================================================" echo " 使用此脚本下载/播放北京宽带网在线电影" echo " 方法:找到在线电影的介绍页面,将该页的的地址复制" echo " 粘贴到下面的输入位置,按回车即可" echo " 使用前提:" echo " 1,使用北京通信公司的adsl上网" echo " 2,系统里安装了MPlayer" echo " 通过此脚本,你可以:" echo " 1,在线播放电影" echo " 选择播放比率,选项1:128k/2:300k/3:clips" echo " 2,下载/获得下载地址,仅限BBN用户" echo "===================================================" trap "echo You are quitting now!;exit" 2 while true do echo echo " 输入播放页面地址: " read page_addr echo echo " 输入播放选项:128k 300k 750k clips" read rate echo case $rate in 128k) rate=128k;; 300k) rate=300k;; 750k) rate=750k;; clips) play_clips;; *) echo "Invalid rate!";continue;; esac wget $page_addr -O temp_file1 grep "play_rate" ./temp_file1|grep "$rate"|tr '"' '\n'|grep "play_rate=$rate"| \ cut -d "(" -f2 |sed 's/\(..$\)//'|sed 's/\(^.\)//'>temp_file2;rm temp_file1 if [ $rate = 750k ] then link_addr1="http://media.bbn.com.cn/zxyy/`cat temp_file2`";rm temp_file2 else link_addr1="http://media.bbn.com.cn`cat temp_file2`";rm temp_file2 fi wget $link_addr1 -O link_addr2;unset link_addr1 if [ $rate = 750k ] then cat link_addr2|grep "ftp"|tr '"' '\n'|grep "ftp" > link_addr3;rm link_addr2 echo "Do you want to download now?" read action case $action in [Yy]) echo "Download Now!";wget `cat link_addr3` -O /mnt/WinE/download_film && rm link_addr3;; [Nn]) echo "Download Later!";cat link_addr3;rm link_addr3;continue;; esac else cat link_addr2|grep "SRC" > link_addr3;rm link_addr2 wget `cat link_addr3|tr '"' '\n'|grep ^http` -O link_addr4;rm link_addr3 cat link_addr4|tr '"' '\n'|grep ^rtsp > real_addr;rm link_addr4 mplayer -playlist real_addr;rm real_addr fi done |