爬虫-下载格式m3u8的视频

视频简单下载

 

import requests

url = 'https://sod.bunediy.com/20220413/liDEn1sp/index.m3u8'
#      https://sod.bunediy.com/20220413/liDEn1sp/index.m3u8
reps = requests.get(url)

#下载文件
with open('1.m3u8', mode='wb') as f:
    f.write(reps.content)
reps.close()

# 读取文件
n = 1
with open('1.m3u8', mode='r', encoding='utf-8') as f:
    #读取每行数据
    for line in f:
        line = line.strip()  # 去掉多余的空格, 换行
        if line.startswith('#'):
            continue
        # print(line) #拿到多有url

        #下载片段
        resp2 = requests.get(line)
        f = open(f'video/{n}.png', mode='wb')
        f.write(resp2.content)
        f.close()
        resp2.close()
        n += 1
        print('完成1个')

 

视频做加密处理, 未解密 

 

posted @ 2022-05-03 08:21  我在春天等伱  阅读(275)  评论(0)    收藏  举报