首页 > 其他 > 详细

如何快速批量下载m3u8(ts)视频?

时间:2019-12-20 12:45:43      阅读:840      评论:0      收藏:0      [点我收藏+]

安装oopsguy/m3u8

https://github.com/oopsguy/m3u8

脚本如下

#!/usr/bin/env bash
[[ -n $DEBUG ]] && set -x
set -eou pipefail

useage() {
    cat <<HELP
USAGE:
    download_m3u8.sh CONFIGFILE DIR
HELP
}

exit_err() {
    echo >&2 "${1}"
    exit 1
}

if [ $# -lt 2 ]; then
    useage
    exit 1
fi
CONFIGFILE=$1
DIR=$2
mkdir -p "${DIR}"
while read -r line;do
arr=($line)
sub="${DIR}/${arr[0]}"
if [ ! -f "${sub}/main.ts" ];then
m3u8 -u="${arr[1]}" -o="${sub}"
fi
done < "${CONFIGFILE}"

定义索引文件 example.index

格式如下
序号 空格 m3u8地址

1 http://example.com/1/hls/index.m3u8
2 http://example.com/1/hls/index.m3u8

下载

download_m3u8.sh example.index ~/Download/example

如何快速批量下载m3u8(ts)视频?

原文:https://www.cnblogs.com/futuretea/p/12072043.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!