1 Star 0 Fork 0

xyislove/python-test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
91sample-2_get_video.py 541 Bytes
一键复制 编辑 原始数据 按行查看 历史
xyislove 提交于 2021-12-19 21:08 . 2021.12.19
# 解析m3u8文件
# 下载视频
import requests
from fake_useragent import UserAgent
import random
ua=UserAgent()
headers={'User-Agent':ua.random}
with open('y-m3u8.txt',mode='r') as f:
n=1
for line in f:
line=line.strip()
if line.startswith('#'):
continue
# print(line)
resp=requests.get(line,headers=headers)
f=open(f'./video/{10000+n}.ts',mode='wb')
f.write(resp.content)
f.close()
resp.close()
n=n+1
print('完成一个下载')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xyislove/python-test.git
git@gitee.com:xyislove/python-test.git
xyislove
python-test
python-test
master

搜索帮助