分页: 3 / 9

Re: 优酷视频mplayer自动连播脚本

发表于 : 2011-10-05 22:28
ctrl-fairy
我使用第一次,成功,然后按ctrl-c终端后就始终挂掉了,显示第四句出错,修改也没用,倒是生成了playlist.title,地址也正确,为什么就不能看啊。 :em20
原来mplayer给我弄挂了……,悲剧。

Re: 优酷视频mplayer自动连播脚本

发表于 : 2011-10-05 22:53
angelsky123321
好东西啊,避开adobe,, :em11

Re: 优酷视频mplayer自动连播脚本

发表于 : 2011-11-05 7:16
yangkyo821
非常强大加好用, :em11 顶了

27楼的下载的代码也很好用,不过我改进了一下:
1.绝对路径改为相对路径,可以直接使用不需修改
2.相对于youku之类有超清版的优先下载超清版
3.视频的命令小小改了下:)

代码: 全选

#!/bin/bash
UA="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"
wurl=$1
fmt=super
parser="http://www.flvcd.com/parse.php?flag=&format=$fmt&kw=$wurl&sbt=%BF%AA%CA%BCGO%21"
wget $parser -q -U "$UA" -O /tmp/dump
iconv -f gbk -t utf-8 /tmp/dump -o /tmp/dump

get_m3u() {
   line=`cat /tmp/dump |wc -l`
   m3u_start=`grep "m3u" /tmp/dump -n`
   start_line=${m3u_start%%:*}
   m3u_end=`grep "M3U" /tmp/dump -n`
   end_line=${m3u_end%%:*}
   cut_line=$(($line-$end_line+2))

   tac /tmp/dump |sed -e "1,$cut_line d" |tac >/tmp/url

   sed -i "1,$start_line d" /tmp/url

   sed -i '/1/s/<input type="hidden" name="inf" value="//g' /tmp/url
}

get_url() {
   grep "<U>" /tmp/dump > /tmp/url
   sed -i 's/<U>//g' /tmp/url
}

get_title() {
grep "<N>" /tmp/dump >/tmp/title
sed -i 's/<N>//g' /tmp/title

file="`sed -n '1p' /tmp/title` "
file=$(echo $file|sed 's/.....$//')

}

get_playlist() {
   for ((i=1; i<=$u_length; ++i))
      do
            ttl=`sed -n "$i p" /tmp/title`
            sed -i "$((2*i-1)) i #EXTINF:PART $i in $u_length, $ttl" /tmp/url
      done
   mv /tmp/url /tmp/play.m3u
   sed -i "1i#EXTM3U" /tmp/play.m3u
}

download() {
mkdir -p ~/Downloads/$file
if [ -s /tmp/play.m3u ]; then
   cat /tmp/play.m3u|sed '/http/!d' > /tmp/playlist.title
   rm /tmp/play.m3u
   t=$(cat /tmp/playlist.title)
   j=1
   for i in $t
   #notify-send "playing $file"
    do
     wget -U "$UA"  $i -O ~/Downloads/$file/$file$j.flv
    j=$((j+1))
    done
elif [ -s /tmp/url ]; then
   cat /tmp/url|sed '/http/!d' >/tmp/playlist
   rm /tmp/url
   t=$(cat /tmp/playlist)
   j=1
   for i in $t
   #notify-send "playing $file"
    do
    wget -U "$UA"  $i -O ~/Downloads/$file/$file$j.flv
    j=$((j+1))
    done
    fi

}


if [ "`grep m3u /tmp/dump`" != "" ] ; then

   get_m3u
else
   
   get_url
fi

get_title

u_length=`cat /tmp/url |wc -l`
t_length=`cat /tmp/title |wc -l`
get_playlist
rm /tmp/title /tmp/dump
download

Re: 优酷视频mplayer自动连播脚本

发表于 : 2011-11-05 8:26
yangkyo821
:em03 貌似mplayer标题乱码是不太好解决,不过可以把代码中mplayer后面都参数“-title $file”去掉,然后标题就还原为mplayer了,达到掩耳盗铃、眼不见为净的效果,推荐大家试下 :em06

Re: 优酷视频mplayer自动连播脚本

发表于 : 2011-11-05 8:28
qq420100523
不错,这脚本要顶一下。

Re: 优酷视频mplayer自动连播脚本

发表于 : 2011-11-05 9:20
mjp123

Re: 优酷视频mplayer自动连播脚本

发表于 : 2011-11-17 23:47
widon1104
我把playlist.list改成playlist.m3u

smplayer -playlist /tmp/playlist.m3u -title $file
改成
smplayer /tmp/playlist.m3u -title $file
才能正确显示播放列表。。。。

Re: 优酷视频mplayer自动连播脚本

发表于 : 2011-11-18 13:39
tracybrser
的确是不错

Re: 优酷视频mplayer自动连播脚本

发表于 : 2012-01-16 17:37
杯具的5650
挺好用的,但是不能播放土豆的视频,奇怪

Re: 优酷视频mplayer自动连播脚本

发表于 : 2012-02-11 10:47
rapistor
mark之,以备重装系统时用。

Re: 优酷视频mplayer自动连播脚本

发表于 : 2012-02-11 12:37
guaicai
杯具的5650 写了:挺好用的,但是不能播放土豆的视频,奇怪
这个是flvcd.com网站解析视频真实地址错误导致的,没办法改。。

Re: 优酷视频mplayer自动连播脚本

发表于 : 2012-02-11 21:58
到处看看
感觉用vlc播放效果更好

代码: 全选

#!/bin/bash
#thanks http://www.flvcd.com
#example: vsplay http://v.youku.com/v_show/id_XMzAwMjI3MDI0.html
# fmt could be: 'normal', 'high', 'super' or 'real'(without the quotation mark), generally denoting 260p, 360p, 480p and the original image respectively, yet depending on the video source defaults though. Leaving it blank leads to the default video quality provided.
#wurl=$(urlencode "$1")
wurl=$1
fmt=super
UA="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"
parser="http://www.flvcd.com/parse.php?flag=&format=$fmt&kw=$wurl&sbt=%BF%AA%CA%BCGO%21"

get_m3u() {
   line=`cat /tmp/dump |wc -l`
   m3u_start=`grep "m3u" /tmp/dump -n`
   start_line=${m3u_start%%:*}
   m3u_end=`grep "M3U" /tmp/dump -n`
   end_line=${m3u_end%%:*}
cut_line=$(($end_line-2))
sed "$cut_line,$ d" /tmp/dump >/tmp/url

   sed -i "1,$start_line d" /tmp/url

   sed -i '/1/s/<input type="hidden" name="inf" value="//g' /tmp/url
}

get_url() {
   grep "<U>" /tmp/dump > /tmp/url
   sed -i 's/<U>//g' /tmp/url
}

get_title() {
grep "<N>" /tmp/dump >/tmp/title
sed -i 's/<N>//g' /tmp/title
file="`sed -n '1p' /tmp/title`"
}

get_playlist() {
   for ((i=1; i<=$u_length; ++i))
      do 
            ttl=`sed -n "$i p" /tmp/title`
            sed -i "$((2*i-1)) i #EXTINF:PART $i in $u_length, $ttl" /tmp/url
      done
   mv /tmp/url /tmp/play.m3u
   sed -i "1i#EXTM3U" /tmp/play.m3u
}

play() {
if [ -s /tmp/play.m3u ]; then
   notify-send "playing $file"
   vlc /tmp/play.m3u
elif [ -s /tmp/url ]; then
   vlc -playlist /tmp/play
fi


}

if ! wget $parser -q -U "$UA" -O /tmp/dump; then
   
   notify-send "cannot get parser, exit"
   exit 0
fi

iconv -f gbk -t utf-8 /tmp/dump -o /tmp/dump


if [ "`grep m3u /tmp/dump`" != "" ] ; then

   get_m3u
else
   
   get_url
fi

get_title

u_length=`cat /tmp/url |wc -l`
t_length=`cat /tmp/title |wc -l`

if [ $u_length -eq 0 ]; then
   notify-send "stream url is null, exit"
   exit 0
fi

if [ $u_length -eq $t_length ]; then
   get_playlist
else 
   notify-send "u_length and t_length not match, generated with no titles. "
fi

rm /tmp/title /tmp/dump

if ! play ; then
   echo "can not play, check the url's in /tmp/playlist or /tmp/playlist.title"
fi




1.jpeg
2.jpeg

Re: 优酷视频mplayer自动连播脚本

发表于 : 2012-02-11 22:55
rapistor
vlc能拖动进度吗?smplayer可以,但占资源多,gmplayer占资源少,但不能拖动进度。
所以没找到个理想的播放器。

Re: 优酷视频mplayer自动连播脚本

发表于 : 2012-02-11 23:17
到处看看
可以啊 还有播放列表呢

Re: 优酷视频mplayer自动连播脚本

发表于 : 2012-02-12 14:35
rapistor
感谢到处看看 ,用vlc较理想的播放器,资源占用较少,也能显示名称,没乱码。全屏正常,youku视频转换到下一节时还是全屏。
只是我用来看youku和m1905时不可以拖动进度。
smplayer可以拖动进度,但占资源太大,且转换到下一节时即退出全屏。
gmplayer不能拖动,且全屏时不正常。
还有请问vlc缓存在哪设置?