Python下载.m3u8视频方法

在https://ffmpeg.en.softonic.com/网站上
根据电脑系统下载ffmpeg软件

import os
import re

import requests
import urllib3

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


def video_download(url: str, name: str):
    """
    下载视频
    :param name:
    :param url:
    :return:
    """
    url = 'https://jx.618g.com/?url={}'.format(url)

    response = requests.get(url, verify=False).text
    print(response)
    video_m = re.search('url=(.*?m3u8)', response).group(1)
    command = r'ffmpeg -y -i ' + video_m + ' -vcodec copy -acodec copy {}.mp4'.format(name)
    os.system(command)


video_download(
    "视频网址",
    "保存名称")

复制代码,下载视频

你可能感兴趣的:(python)