您的位置:首页 > 其它

M3U8文件真实TS流获取工具

2015-12-23 11:31 531 查看
在进行一些M3U8文件的学习中,自己写了这个抓取全文件TS流的脚本(cygwin和linux中都可以自行),为了加快下载速度还进行多线程的优化!

0x00 使用方法:

xx.sh  http://30.9.159.145:8080/ts_file/gare1/fileSequence 0 169
http://30.9.159.145:8080/ts_file/gare1/fileSequence  就是真实ts流的前缀名称(http://30.9.159.145:8080/ts_file/gare1/fileSequence0.ts 去除 0.ts)

0 是起始的TS流计数

169 是中止的TS流计数

0x01 xx.sh脚本如下:

#!/bin/sh

if [ -n "$1" -a -n "$2" -a -n "$3" ]

then

  echo "begin down"

else

  echo "Sorry,you didn't identify hls url prefix."

  exit

fi

count=$2

url=$1

while (( $count <= $3 ));

do

  echo "\$@ Parameter index #$count = $count"

  

  wget --user-agent="Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16" "$url$count.ts" &

  

  count=$[ $count + 1 ]

  

  if (( $count%3 == 0));then

  echo "wait for 5 jobs ends start"

  wait

  echo "wait for 5 jobs ends end"

  fi

  

done

wait

  echo "download ok======================!"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: