charles 抓取的内容与 python+requests 获取的内容不一样(python+requests 获取的内容是不完整的),请问是什么原因?
import requests
import json
#import urllib3
# 请求地址
url = "https://xiapi.xiapibuy.com//api/v2/search_items/?by=relevancy&categoryids=8436&keyword=%E5%AF%B5%E7%89%A9%E8%A1%A3%E6%9C%8D&limit=50&newest=0&order=desc&page_type=search&search_prefill=533&skip_autocorrect=1&version=2"
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36",
"content-type": "application/json; charset=utf-8",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9",
"x-shopee-language": "zh-Hant",
"accept": "*/*",
"sec-fetch-mode": "cors",
'Connection' : 'Keep-Alive',
"sec-fetch-dest": "empty",
"sec-fetch-site": "same-origin",
"cookie": '_gcl_au=1.1.1950202641.1614253363; __BWfp=c1614255385494x4861ad98c; SPC_IA=-1; SPC_EC=-; SPC_U=-; REC_T_ID=24860de2-7763-11eb-bd88-4cd98f6396a5; SPC_F=kIgpBjzooYwbSeny10VD6OAmFIgeOOg3; REC_T_ID=2493be6c-7763-11eb-b4a3-f8f21e1af482; SPC_SI=mall.17RfWei0O6TM7UTuozlgZRk0BW6lLDn4; csrftoken=h5XPkI4xC55yw94TnEN874g3QAAJN6KV; welcomePkgShown=true; SPC_CT_7f3c470f="1614504896.PiZPn+qb4Gb/c3/vSaDeWb+1Kd7KhVAU7zBIHfZbosw="; SPC_CT_cf0618be="1614504896.QasEq9Z0nUzm/kg3plAS8NfpKq6gH2NdCcQ5zRHz+qs="; SPC_CT_5b89d0d0="1614504896.tdhrk1hM1L7/TfwNNkrJFGRMgEjx0/OW5jZt6cNcNXo="; SPC_CT_9507a35d="1614504896.AwSBD6+9WJ5/RAU52y5Lb0Di/HeHFtWcGdoKLofxm5Q="; SPC_CT_e7a3420c="1614504913.4hgQsHsbTrPSr0UTX11hJjYWbq6FmLv/hHbnCXpfSSs="; SPC_CT_f4802b3d="1614504989.vmuSBai4lwfpDp6llJszfGj5gvU5KxH9bQvZmRTJA1o="; SPC_CT_721da2ed="1614504995.fBXlX3MPuvpHDaI4FicMV8KkixqVs4Wm0++Bm751AnA="; SPC_CT_99fc082e="1614505158.SAPj9KV+7VhSJKLpH179u0ITsVlNK8AZNSItAHq/+9g="; SPC_CT_ef220289="1614505191.g3pkOsbL3/6HFr6TOrdMu2PxP2FtcVmioCgImACSvoA="; _med=refer; SPC_CT_f7b18e6e="1614507953.i7wqeaW457WGDw7BnAhwvVAFcjJH8eTBPagiRpawONk="; SPC_R_T_ID="HNFzW4Tiu1UQBC6RcW2I+etJblCalmHZWW6XJ7TkTkMriKgGP1+n6NthWAI44MZ+YV2zy4gvhS7XquqyrsWUczB3X0zp8Upo4Jfayb+8Wsg="; SPC_T_IV="/g4WEECC+1erG7aePadPTQ=="; SPC_R_T_IV="/g4WEECC+1erG7aePadPTQ=="; SPC_T_ID="HNFzW4Tiu1UQBC6RcW2I+etJblCalmHZWW6XJ7TkTkMriKgGP1+n6NthWAI44MZ+YV2zy4gvhS7XquqyrsWUczB3X0zp8Upo4Jfayb+8Wsg="'
}
# Python requests 设置verify=False移除SSL认证
# 然后解决InsecureRequestWarning警告
# 控制台输出移除SSL认证警告
#urllib3.disable_warnings()
response = requests.get(url, headers)
#response = requests.get(url, headers=headers, verify=False)
#response.encoding="gbk"
res = response.text
print(res)
获取到的数据如下:
charles 抓取到的数据如下:
缺失的部分如下:
\u7d0d\u745e \u897f\u65bd