一、设置爬虫程序
# requests 请求b站视频
import jsonimport fake_useragent
import requests
from lxml import etreeif __name__ == '__main__':# UA伪装head = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"# 防盗链, "Referer": "https://www.bilibili.com/","Cookie": "buvid3=91B8BA43-1670-06DD-D617-A4BE8570FF9608968infoc; b_nut=1724837808; CURRENT_FNVAL=4048; buvid4=96C57FA0-EC96-E6D4-4CCA-9339497F5DFE10133-024082809-uLghB5be5rdUD6te6fDF9q5w7TCu2G5MSPva4hi9pDhuGRoQbR0N8y%2BaNHjruT6i; _uuid=73DE1A3B-1B63-A101010-53103-66E544C612BF73962inf