代码拉取完成,页面将自动刷新
同步操作将从 witch/tang 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import requests
from lxml import etree
import re
monv = ""
ai= 0
魔女_9 = ""
bilibili_all_list = []
header = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
}
url = 'https://www.bilibili.com/v/popular/rank/all'
resp = requests.get(url,headers=header)
text = resp.text
html = etree.HTML(text)
魔女 = html.xpath('//ul[@class="rank-list"]/li[@*]/div[@class="content"]/div[@class="info"]/a/text()')
爱 = html.xpath('//ul[@class="rank-list"]/li[@*]/div[@class="content"]/div[@class="info"]/div[@class="detail"]/span[@class="data-box"][1]/text()')
playlist = []
for target_listt in 爱:
playlist.append(re.sub('\n|\s','',target_listt))
#print(playlist)
titlelsit = []
for target_listt in 魔女:
titlelsit.append(target_listt)
#print(titlelsit)
#魔女.append()
#int(魔女)
#for target_list in zip(titlelsit,playlist):
for target_listt in 魔女:
ai = ai+1
monv = ("monvai魔女"+str(ai)+(target_listt)+"\n")
魔女_9 = (魔女_9+monv)
#with open(r"./db_text.txt","w",encoding="utf-8"):
#f.weite(魔女_9)
#import pandas as pd
#data = pd.Dataframe(data=魔女_9,columns=[排名])
#data.to_excel(r"./db.text.xlsx",encoding="utf-8")
_bilibili_video_nameAndnum = []
for _bilibili_video_name,_bilibili_video_play_num in zip(titlelsit,playlist):
_bilibili_video_nameAndnum=[_bilibili_video_name,_bilibili_video_play_num]
bilibili_all_list.append(_bilibili_video_nameAndnum)
print(bilibili_all_list)
# kitemoon 修改不合理的变量名
topList = ""
for target_id in bilibili_all_list:
topList = topList +str(target_id) +"\n"
f = open("./魔女.txt","w",encoding="utf-8")
f.write(ccc)
f.close()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。