以前看个视频,可能还得到处找下载按钮,要不就有一些伪装的下载按钮,结果一点击,就弹出来的是广告,就很糟心…

但是
当有了Python之后,咱们只需要运行一下,分分钟就下载好了,只要你想要的,就没有不能下载的。

准备工作
开发环境:
版 本: python 3.8
编辑器:pycharm 2021.2
第三方库:
requests >>> pip install requests
tqdm >>> pip install tqdm
视频讲解
视频里我都详细讲解了,刚学Python的兄弟可以看视频跟着操作。
视频地址:https://www.bilibili.com/video/BV1ma411y7Ka/
代码展示
下载地址我都屏蔽了,详细操作看视频
import requests
import re
from tqdm import tqdm
print(requests.get('https://***.com/20210731/Ippn8ThS/index.m3u8').text)
response = requests.get('https://.....com/20220205/B7TL7zXw/index.m3u8')
ts_list = re.sub('#E.*', '', response.content.decode()).split()
for ts in tqdm(ts_list):
video_data = requests.get(ts).content
with open('1.mp4', mode='ab') as f:
f.write(video_data)
效果展示
运行
这里我把下载名字命名为了1,大家可以自己在代码里改一下名字。
兄弟们快去试试吧!
网友评论