import requests
# 视频地址
# url = 'http://upos-sz-mirrorks3.bilivideo.com/upgcxcode/56/02/138550256/138550256-1-30080.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1604397291&gen=playurl&os=ks3bv&oi=3733189308&trid=ac6c918809ad47bb818af66c5c989895u&platform=pc&upsig=c4c5bc44e2df864e2c92e42e4b4a9668&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,platform&mid=0&orderid=0,3&agrr=1&logo=80000000'
# 音频地址
# url = 'http://upos-sz-mirrorhw.bilivideo.com/upgcxcode/56/02/138550256/138550256-1-30232.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1604397291&gen=playurl&os=hwbv&oi=3733189308&trid=ac6c918809ad47bb818af66c5c989895u&platform=pc&upsig=03ee105c3f33a897ae38ccd9436df6fd&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,platform&mid=0&orderid=0,3&agrr=1&logo=40000000'
headers = {
'referer': 'https://www.bilibili.com/video/BV1WJ411e76L?from=search',
'sec-ch-ua': '"\\Not;A\"Brand";v="99", "Google Chrome";v="85", "Chromium";v="85"',
'sec-ch-ua-mobile': '?0',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36'
}
info = requests.get(url=url,headers=headers).content
print(info)
with open('1.mp4','wb') as f:
f.write(info)