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

I use Python code to download the essence of the dance area and enjoy it slowly~

編輯:Python

Preface

Hi. , Hello, everyone , This is the demon king ~

Today, I accidentally opened a website , I saw the essence of its dance area MP4,

At first glance, it's out of control , But it's too bold , I'm afraid it's off the shelf , Hurriedly opened my python

Write this code and download them all , Enjoy ~

Environment use :

  • Python 3.8
  • Pycharm

Code

The import module

import requests
import re
url = 'https://v..com/api/stream/getStreamUrl'
data = {

'v': '220320220627',
'did': '10000000000000000000000000001501',
'tt': '1656318502',
'sign': 'f0194e25c25283cbd53ef52c0acf45f8',
'vid': 'kDe0W29DOwaMA4Bz',
}
headers = {

'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36'
}
response = requests.post(url=url, data=data, headers=headers)
print(response.json())
m3u8_url = response.json()['data']['thumb_video']['high']['url']
print(m3u8_url)
m3u8_data = requests.get(url=m3u8_url, headers=headers).text
m3u8_data = re.sub('#E.*', '', m3u8_data).split()
for ts in m3u8_data:
ts_url = 'https://play-tx-ugcpub..cn/live/high_33282775320220508200007-upload-d9f8/' + ts
ts_content = requests.get(url=ts_url, headers=headers).content
with open('【 Milk and rice 】05-07 This popularity value TOP2 dance .mp4', mode='ab') as f:
f.write(ts_content)
print(ts_url)

This code is provided by : Qingdeng Education - Self Travel



Tail language

There is no fast track to success , There is no highway to happiness .

All the successes , All come from tireless efforts and running , All happiness comes from ordinary struggle and persistence

—— Inspirational quotes

This article is finished ~ Interested partners can copy the code to try

Your support is my biggest motivation !! Remember Sanlian ~ Welcome to read previous articles ~


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