携程酒店 phantom-token token1004 分析
声明
本文章中所有内容仅供学习交流使用,不用于其他任何目的,抓包内容、敏感网址、数据接口等均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关!
部分python代码
搞APP搞的心态有点崩了,换一个简单点分析明天再接着学app。简单分析携程酒店phantom-token。
headers = {'accept': 'application/json','accept-language': 'zh-CN,zh;q=0.9','cache-control': 'no-cache','content-type': 'application/json;charset=UTF-8','pragma': 'no-cache','priority': 'u=1, i','sec-ch-ua': '"Not(A:Brand";v="99", "Microsoft Edge";v="133", "Chromium";v="133"','sec-ch-ua-mobile': '?0','sec-ch-ua-platform': '"Windows"','sec-fetch-dest': 'empty','sec-fetch-mode': 'cors','sec-fetch-site': 'same-site','user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0', }json_data = {'hotelIdFilter': {'hotelAldyShown': [],},'destination': {'type': 1,'geo': {'cityId': -1,'provinceId': 16,'countryId': 1,},'keyword': {'word': '',},},'date': {'dateType': 1,'dateInfo': {'checkInDate': '20250513','checkOutDate': '20250514',},},'filters': [{'filterId': '17|5','type': '17','subType': '2','value': '5',},{'filterId': '29|1','type': '29','value': '1|1','subType': '2',},],'extraFilter': {'childInfoItems': [],'sessionId': '',},'paging': {'pageCode': '102002','pageIndex': 1,'pageSize': 10,},'roomQuantity': 1,'recommend': {'nearbyHotHotel': {},},'genk': True,'residenceCode': 'CN','head': {'platform': 'PC','isSSR': False,},'ServerData': '', } cp = execjs.compile(open('token1004.js','r',encoding='utf-8').read()) token = cp.call('getToken',json_data) print(token) headers['phantom-token'] = token response = requests.post('json/fetchHotelList',cookies=cookies,headers=headers,json=json_data, ) print(response.text)