爬虫-视频下载
作者:互联网
视频简单下载
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个')
视频做加密处理, 未解密
标签:视频,m3u8,爬虫,mode,close,line,open,resp2,下载 来源: https://www.cnblogs.com/longly1111/p/16217617.html