爬虫-下载格式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 @   我在春天等伱  阅读(254)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示