程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Since I learned how to parse videos in Python, I dont have to find out where the download button is. Its really convenient

編輯:Python

python One click download video

    • preparation
    • Video Explanation
    • Code display
    • Effect display

I used to watch a video , You may also have to find the download button , Or there are some disguised download buttons , Result one click , What pops up is an advertisement , It's bad …


however

When there's a Python after , We just need to run , Download it in minutes , As long as you want , There is nothing that cannot be downloaded .

preparation

development environment :

 edition Ben : python 3.8
Editor :pycharm 2021.2

Third party Library :

requests >>> pip install requests
tqdm >>> pip install tqdm

Video Explanation

I explained everything in detail in the video , Just learned Python My brother can watch the video and follow the operation .

Python Reptiles : Parse any video

Code display

I have blocked the download address , See the video for detailed operation

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)

Effect display

function
Here I name the download as 1, You can change your name in the code .
Brothers, go and have a try !


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved