M3U8文件真实TS流获取工具

在进行一些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======================!"

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值