请问这种python爬虫得到的字符串怎么解码变成汉字(马蜂窝),
使用gbk解码试试呢?
import requests
url = 'https://www.mafengwo.cn/hotel/info/comment_list?poi_id=98014&type=0&keyword_id=0&page=1&_ts=1675126904317&_sn=55c10aaa02'
headers = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
"Host": "www.mafengwo.cn",
"Referer": "https://www.mafengwo.cn/hotel/98014.html",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"X-Requested-With": "XMLHttpRequest"
}
response = requests.get(url,headers=headers).json() #返回的数据是json格式,所以直接把结果转化为json格式
print(response['html'])