wang156860009 / pythonlrean

0 stars 0 forks source link

pachong #4

Open wang156860009 opened 9 months ago

wang156860009 commented 9 months ago

import requests #下载网页 import bs4 #解析网页

headers ={ 'accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/,/*;q=0.8',

'accept-encoding': 'gzip, deflate, br',

'accept-language': 'zh-CN,zh;q=0.9', 'cache-control': 'no-cache, no-store, must-revalidate', 'Content-Type': 'text/html; charset=utf-8', 'Connection': 'keep-alive', 'referer': 'https://book.douban.com/',

'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Core/1.94.212.400 QQBrowser/12.0.5448.400'

}

page_obj = requests.get("https://book.douban.com/subject/36365320/",headers=headers) page_obj.encoding = 'utf-8' print(page_obj.text)