"""
姓名 :赵康乐
职业 :学生
日期 :2022-2-8
任务 :爬取2022年度小说排行榜
"""
import requests
from bs4 import BeautifulSoup
url = "https://www.xbiquge.la/paihangbang/"
headers = {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0"
}
response = requests.get(url,headers).text
# print(response)
soup = BeautifulSoup(response,"lxml")
for i in range(1,5):
content = soup.find("div",class_="box b"+str(i))
lis = content.find_all("li")
for li in lis:
title = li.a.text
new_url = li.a["href"]
print(title,new_url)