无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

b站視頻音頻獲取簡單實踐~以Lumi美麗的神話為例

2023-02-01 03:42 作者:蕪湖小量化  | 我要投稿

分析網(wǎng)頁源代碼 找到音視頻標(biāo)簽? 不同鏈接對應(yīng)不同清晰度

"audio":[{"id":30280, "baseurl" : ?# 此處鏈接為音頻鏈接

"video":{{"id:80","baseurl":? # 可以根據(jù)此處鏈接獲取視頻鏈接

# 此爬蟲僅使用request第三方庫
import?requests



#?定義請求標(biāo)頭,參數(shù)詳見edge檢查功能,模擬用戶行為

headers = {'authority':'',

????????????????????'accept':'',

????????????????????'accept_encoding':'',

????????????????????'accept_language':'',

????????????????????'cookie':'',

????????????????????'referer':''?,# b站存在referer反爬機(jī)制,務(wù)必加上此項

????????????????????'user-agent':'',

}


# 爬取頁面

def get_parse():

????????response=requests.get('https://www.bilibili.com/video/BV1wY4y1f7yn/??spm_id_from=333.999.0.0&vd_source=56a22aa7ae645f665df432c707fcbd88', headers=headers)

????????print(response.status_code)

????????response.encoding = response.apparent_encoding

? ?????download(video_url, audio_url)



# 下載音頻和視頻資源

def download(video_url, audio_url):

??? ????video = requests.get(video_url, headers=headers).content

??? ????audio = requests.get(audio_url, headers=headers).content

??????? with open('美麗的神話.mp4', 'wb') as f:

??????? ????f.write(video)

??????? with open('美麗的神話.mp3', 'wb') as f:

??????????? f.write(audio)



# 運(yùn)行程序

video_url =''? # 此處為頁面分析所得的baseurl:視頻鏈接

audio_url =''??# 此處為頁面分析所得的baseurl:音頻鏈接

get_parse()


# 歡迎關(guān)注露米Lumi_Offical喵!


b站視頻音頻獲取簡單實踐~以Lumi美麗的神話為例的評論 (共 條)

分享到微博請遵守國家法律
虎林市| 张北县| 乐安县| 吉首市| 方城县| 独山县| 桐梓县| 台江县| 萍乡市| 南靖县| 佳木斯市| 南阳市| 镇沅| 奇台县| 中宁县| 毕节市| 通山县| 泰来县| 西吉县| 张家界市| 义乌市| 广西| 长寿区| 嘉定区| 固原市| 潞城市| 游戏| 襄城县| 澎湖县| 衡山县| 临猗县| 海口市| 神池县| 苏尼特右旗| 崇文区| 濉溪县| 璧山县| 酉阳| 宁国市| 射洪县| 新和县|