加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

shell m3u8-->ts

发布时间:2020-12-15 16:45:52 所属栏目:安全 来源:网络整理
导读:shell:m3u8--ts 需求:已知批量 m3u8 uri,求完整 ts文件 uri #由于sed不支持文本替换,生成临时文件test_file#curl-s忽略默认如下输出#%Total%Received%XferdAverageSpeedTimeTimeTimeCurrent#DloadUploadTotalSpentLeftSpeed#1075371075370019870--:--:---

shell:m3u8-->ts

  • 需求:已知批量 m3u8 uri,求完整 ts文件 uri

#由于sed不支持文本替换,生成临时文件test_file
#curl-s忽略默认如下输出
#%Total%Received%XferdAverageSpeedTimeTimeTimeCurrent
#DloadUploadTotalSpentLeftSpeed
#1075371075370019870--:--:----:--:----:--:--4007
#
#sed带参替换四种方式:
#1.evalsed’s/$a/$b/’filename
#2.sed"s/$a/$b/"filename
#3.sed’s/’$a’/’$b’/’filename
#4.seds/$a/$b/filename

#!/bin/bash

m3u8_list=`catm3u8`
foriin$m3u8_list
do
echo"$i"&>>all_log
ts_list=`curl-s$i|grep'.ts$'`
forjin$ts_list
do
echo"$i">test_file
sed"s/index.m3u8/$j/"test_file&>>all_log
done
done
  • m3u8:

http://14.18.146.165:8802/vod/ymx//225731_3/index.m3u8
http://14.18.146.165:8802/vod/ymx//225731_4/index.m3u8
http://14.18.146.165:8802/vod/ymx//225731_5/index.m3u8
  • all_log:

[root@test-CNC-TJ-19-28yuhuancun]#head171723.txt
http://14.18.146.165:8802/vod/hn_live_165/8592_58438/index.m3u8
http://14.18.146.165:8802/vod/hn_live_165/8592_58438/video_0.ts
http://14.18.146.165:8802/vod/hn_live_165/8592_58438/video_1.ts
http://14.18.146.165:8802/vod/hn_live_165/8592_58438/video_2.ts
http://14.18.146.165:8802/vod/hn_live_165/8592_58438/video_3.ts

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读