愛奇藝!會員視頻獲取-因為太怕痛就全點防御了-4為例
# 分析網(wǎng)頁源代碼?
"codecs":"avc1.640032","base_url":? # 此處鏈接為視頻存放地址
"audio":[{"start_with_sap":0,"bandwidth":192410,"sar":"","backupUrl":? # 音頻地址

# 本方法僅使用request庫
import requests

# 爬取保存音視頻
base_cookie = ''? 瀏覽器cookie
headers = {
????'authority':'',
????'accept':'',
????'accept_encoding':'',
????'accept_language':'',
????'referer':'',
????'cookie': base_cookie +?'SESSDATA=; bili_jct=; DedeUserID=; DedeUserID__ckMd5=; ?b_ut=5; b_lsid=; sid=;? ?# 模擬愛奇藝!大會員登錄
????'user-agent':'',
}
def crawler(video_url, audio_url):
? ?response = requests.get('https://www.bilibili.com/bangumi/play/ep733771?from_spmid=666.4.schedule.2';, headers=headers)
? ?print(response.status_code)
? ?if response.status_code == 200:
? ? ? ?video = requests.get(video_url, headers=headers).content
? ? ? ?audio = requests.get(audio_url, headers=headers).content
? ? ? ?with open('因為太怕痛就全點防御了-4.mp4', 'wb') as f:
? ? ? ? ? ?f.write(video)
? ? ? ?with open('因為太怕痛就全點防御了-4.mp3', 'wb') as f:
? ? ? ? ? ?f.write(audio)
? ?else:
? ? ? ?print('爬取錯誤')
video_url = ''
audio_url = ''
crawler(video_url, audio_url)

私貨:歡迎關(guān)注雫るる_Official 喵!歡迎關(guān)注露米Lumi_Official喵!謝謝了喵

