import requests
from lxml import html
import os
import pprint
import time
import random
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
header = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
}
save_url = r'D:\Download\bilibili'
def get_yeshu(): #每个页面url
yeshu = []
for i in range(1):
yeshu.append("https://api.vc.bilibili.com/board/v1/ranking/top?page_size=10&next_offset={yeshu}&tag=%E4%BB%8A%E6%97%A5%E7%83%AD%E9%97%A8&platform=pc".format(yeshu=i*10+1))
return yeshu
def get_url(pagelist): #获得视频真实url信
session=requests.session()
for url in pagelist:
x = 0
response = session.get(url,headers=header).json()
# pprint.p
Python 爬取Bilibili 视频
最新推荐文章于 2024-08-15 20:28:49 发布