原来mplayer给我弄挂了……,悲剧。我使用第一次,成功,然后按ctrl-c终端后就始终挂掉了,显示第四句出错,修改也没用,倒是生成了playlist.title,地址也正确,为什么就不能看啊。
优酷视频mplayer自动连播脚本
- ctrl-fairy
- 帖子: 116
- 注册时间: 2011-04-28 18:05
Re: 优酷视频mplayer自动连播脚本
代码: 全选
linux和windows对我等菜鸟,都是浮云!
- angelsky123321
- 帖子: 485
- 注册时间: 2011-04-02 19:18
- 系统: windows8.1
- 来自: QD
-
- 帖子: 52
- 注册时间: 2011-03-23 23:30
Re: 优酷视频mplayer自动连播脚本
非常强大加好用,
顶了
27楼的下载的代码也很好用,不过我改进了一下:
1.绝对路径改为相对路径,可以直接使用不需修改
2.相对于youku之类有超清版的优先下载超清版
3.视频的命令小小改了下:)

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
上次由 yangkyo821 在 2011-11-05 9:23,总共编辑 1 次。
-
- 帖子: 52
- 注册时间: 2011-03-23 23:30
Re: 优酷视频mplayer自动连播脚本


- qq420100523
- 帖子: 1684
- 注册时间: 2009-07-31 18:56
- 系统: windows、ubuntu
- 来自: 广东阳江
Re: 优酷视频mplayer自动连播脚本
不错,这脚本要顶一下。
- mjp123
- 帖子: 703
- 注册时间: 2009-04-09 15:06
- widon1104
- 帖子: 846
- 注册时间: 2008-07-17 10:55
Re: 优酷视频mplayer自动连播脚本
我把playlist.list改成playlist.m3u
把
smplayer -playlist /tmp/playlist.m3u -title $file
改成
smplayer /tmp/playlist.m3u -title $file
才能正确显示播放列表。。。。
把
smplayer -playlist /tmp/playlist.m3u -title $file
改成
smplayer /tmp/playlist.m3u -title $file
才能正确显示播放列表。。。。
-
- 帖子: 11
- 注册时间: 2011-08-19 13:54
- 联系:
-
- 帖子: 20
- 注册时间: 2012-01-16 10:23
Re: 优酷视频mplayer自动连播脚本
挺好用的,但是不能播放土豆的视频,奇怪
- rapistor
- 帖子: 1983
- 注册时间: 2009-01-19 15:09
- guaicai
- 帖子: 169
- 注册时间: 2012-01-29 9:30
- 系统: Fedora19 Xfce
Re: 优酷视频mplayer自动连播脚本
这个是flvcd.com网站解析视频真实地址错误导致的,没办法改。。杯具的5650 写了:挺好用的,但是不能播放土豆的视频,奇怪
===============================
XP XP XP XP XP XP XP XP XP XP XP XP
??现在的人问问题都是让人来猜吗??
XP XP XP XP XP XP XP XP XP XP XP XP
===============================
XP XP XP XP XP XP XP XP XP XP XP XP
??现在的人问问题都是让人来猜吗??
XP XP XP XP XP XP XP XP XP XP XP XP
===============================
- 到处看看
- 论坛版主
- 帖子: 8486
- 注册时间: 2010-01-17 13:05
- 系统: ubuntu
Re: 优酷视频mplayer自动连播脚本
感觉用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
- rapistor
- 帖子: 1983
- 注册时间: 2009-01-19 15:09
- 到处看看
- 论坛版主
- 帖子: 8486
- 注册时间: 2010-01-17 13:05
- 系统: ubuntu
Re: 优酷视频mplayer自动连播脚本
可以啊 还有播放列表呢
- rapistor
- 帖子: 1983
- 注册时间: 2009-01-19 15:09
Re: 优酷视频mplayer自动连播脚本
感谢到处看看 ,用vlc较理想的播放器,资源占用较少,也能显示名称,没乱码。全屏正常,youku视频转换到下一节时还是全屏。
只是我用来看youku和m1905时不可以拖动进度。
smplayer可以拖动进度,但占资源太大,且转换到下一节时即退出全屏。
gmplayer不能拖动,且全屏时不正常。
还有请问vlc缓存在哪设置?
只是我用来看youku和m1905时不可以拖动进度。
smplayer可以拖动进度,但占资源太大,且转换到下一节时即退出全屏。
gmplayer不能拖动,且全屏时不正常。
还有请问vlc缓存在哪设置?
坚守在linux的天堂!