当前位置:网站首页>b站视频链接快速获取

b站视频链接快速获取

2022-07-06 12:56:00 聆听我的召唤,菜鸟进化


from lxml import etree
import time
import json
import requests
import csv
import random
import os
from fake_useragent import UserAgent
headers={
    
            'User-Agent':UserAgent().random
        }

for i in range(1,35):
    url='https://api.bilibili.com/x/web-interface/search/type?__refresh__=true&_extra=&context=&page={}&page_size=42&from_source=&from_spmid=333.337&platform=pc&highlight=1&single_column=0&keyword=%E8%8E%8E%E5%A3%AB%E6%AF%94%E4%BA%9A%E6%88%8F%E5%89%A7%E8%A1%A8%E6%BC%94&category_id=&search_type=video&dynamic_offset=72&preload=true&com2co=true'.format(i)
    response=requests.get(url=url,headers=headers)
    data=response.json()
    
    cards=data['data']['result']
    print(i)
    for card in cards:
        li=[]
        link=card["arcurl"]#评分
        times=card["duration"]#影名
        description=card["title"]#url
        li.append(link)
        li.append(times)
        li.append(description)
        
        print(li)
    
        with open('biliok.csv', 'a', newline='', encoding='utf-8-sig') as fp:
                writer = csv.writer(fp)
                writer.writerow(li)
    
    time.sleep(float(format(random.uniform(0,3), '.2f')))
        
    
    
    
    
    
    
    
    
    
        
        

原网站

版权声明
本文为[聆听我的召唤,菜鸟进化]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_45889931/article/details/125587196