import requests
from bs4 import BeautifulSoup
import lxml
url = "https://music.douban.com/top250"
params = {"start":225}
headers = {
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
"Cookie": 'll="118178"; bid=xOL938asFC0; __gads=ID=1e173827052fbfae-2237b8b93fdf003f:T=1681947340:RT=1681947340:S=ALNI_MZSeHau4y140HlSeBvzIvluphnqHw; __gpi=UID=00000bfa2e7b79af:T=1681947340:RT=1682033932:S=ALNI_MYHaFlQHLK4MRWstYmbab4hArWLYw; _pk_ref.100001.afe6=%5B%22%22%2C%22%22%2C1682592499%2C%22https%3A%2F%2Fcn.bing.com%2F%22%5D; _pk_id.100001.afe6=7def2797f09e923b.1682592499.1.1682592499.1682592499.; _pk_ses.100001.afe6=*; ap_v=0,6.0; __utma=30149280.2097799149.1681628108.1682033932.1682592499.6; __utmc=30149280; __utmz=30149280.1682592499.6.2.utmcsr=cn.bing.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmt=1; __utmb=30149280.1.10.1682592499',
'Host': 'music.douban.com',
'Referer': 'https://cn.bing.com/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.58'
}
response = requests.get(url=url,params=params,headers=headers)
response_str = str(response)
soup = BeautifulSoup(response,'lxml')
print(soup.title)
|