[JavaScript] 纯文本查看 复制代码
const chalk = require("chalk")
function setProxy(obj, objNmae) {
return new Proxy(obj, {
apply: function (traget, thisArg, argList) {
const result = Reflect.apply(traget, thisArg, argList)
if (typeof result === "undefined") {
console.log("CALL", "方法:", objNmae, "参数:", argList, "返回值类型:", chalk.red(typeof result));
} else {
console.log("CALL", "方法:", objNmae, "参数:", argList, "返回值类型:", typeof result);
}
return result
},
get: function (traget, proper, receiver) {
const result = Reflect.get(traget, proper, receiver)
if (proper === "Math") {
return result
}
if (typeof result === "undefined") {
console.log("GET", "对象:", objNmae, "属性名称:", proper, "属性类型:", typeof proper, "属性值类型:", chalk.red(typeof result));
} else {
console.log("GET", "对象:", objNmae, "属性名称:", proper, "属性类型:", typeof proper, "属性值类型:", typeof result);
}
return result
},
set: function (traget, proper, value, receiver) {
const result = Reflect.set(traget, proper, value, receiver)
console.log("SET", "对象:", objNmae, "属性名称:", proper, "属性类型:", typeof proper, "属性值类型:", typeof value);
return result
}
})
}
window = setProxy(globalThis, "window")
// GET 对象: window 属性名称: CanvasRenderingContext2D 属性类型: string 属性值类型: undefined
// GET 对象: window 属性名称: HTMLCanvasElement 属性类型: string 属性值类型: undefined
function CanvasRenderingContext2D(canvas) {
canvas: canvas
// this.direction = "ltr"
// this.fillStyle = "rgba(200, 200, 0, 0.5)"
// this.filter = "none"
// this.font = "100px Arial"
// this.fontKerning = "auto"
// this.fontStretch = "normal"
// this.fontVariantCaps = "normal"
// this.globalAlpha = 1
// this.globalCompositeOperation = "source-over"
// this.imageSmoothingEnabled = true
// this.imageSmoothingQuality = "low"
// this.letterSpacing = "0px"
// this.lineCap = "butt"
// this.lineDashOffset = 0
// this.lineJoin = "miter"
// this.lineWidth = 1
// this.miterLimit = 10
// this.shadowBlur = 0
// this.shadowColor = "rgba(0, 0, 0, 0)"
// this.shadowOffsetX = 0
// this.shadowOffsetY = 0
// this.strokeStyle = "#000000"
// this.textAlign = "start"
// this.textBaseline = "alphabetic"
// this.textRendering = "auto"
// this.wordSpacing = "0px"
}
window.CanvasRenderingContext2D = setProxy(CanvasRenderingContext2D, "CanvasRenderingContext2D")
CanvasRenderingContext2D.prototype = setProxy(CanvasRenderingContext2D.prototype, "CanvasRenderingContext2D.prototype")
function fillRect() { }
CanvasRenderingContext2D.prototype.fillRect = setProxy(fillRect, "fillRect")
CanvasRenderingContext2D.prototype.fillRect.toString = function toString() {
return 'function fillRect() { [native code] }'
}
function fillText() { }
CanvasRenderingContext2D.prototype.fillText = setProxy(fillText, "fillText")
CanvasRenderingContext2D.prototype.fillText.toString = function toString() {
return 'function fillText() { [native code] }'
}
let nth = 1
function HTMLCanvasElement() {
}
function getContext() {
if (arguments[0] === "2d") {
tow2 = new CanvasRenderingContext2D(this)
return setProxy(tow2, "CanvasRenderingContext2D")
}
if (arguments[0] === "webgl") {
}
}
HTMLCanvasElement.prototype.getContext = setProxy(getContext, "getContext")
function toDataURL() {
if (this.width === 220 && this.height === 30) {
return `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANwAAAAeCAYAAABHenA+AAAAAXNSR0IArs4c6QAAAMNJREFUeF7t00ENAAAIAzHm3zQu7lUMLGm4nSNAIBNYtmSIAIETnCcgEAoILsQ2RUBwfoBAKCC4ENsUAcH5AQKhgOBCbFMEBOcHCIQCgguxTREQnB8gEAoILsQ2RUBwfoBAKCC4ENsUAcH5AQKhgOBCbFMEBOcHCIQCgguxTREQnB8gEAoILsQ2RUBwfoBAKCC4ENsUAcH5AQKhgOBCbFMEBOcHCIQCgguxTREQnB8gEAoILsQ2RUBwfoBAKCC4ENsUgQen2QAfWCC+5AAAAABJRU5ErkJggg==`
}
if (this.width === 2 && this.height === 2) {
return `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAAA5JREFUGFdjZIACRhgDAAAtAANNw4UTAAAAAElFTkSuQmCC`
}
}
HTMLCanvasElement.prototype.toDataURL = setProxy(toDataURL, "toDataURL")
HTMLCanvasElement.prototype.toDataURL.toString = function toString() {
return 'function toDataURL() { [native code] }'
}
function setAttribute() {
this[arguments[0]] = arguments[1]
}
HTMLCanvasElement.prototype.setAttribute = setProxy(setAttribute, "setAttribute")
HTMLCanvasElement.prototype.toDataURL.toString = function toString() {
return 'function toDataURL() { [native code] }'
}
window.HTMLCanvasElement = setProxy(HTMLCanvasElement, "HTMLCanvasElement")
HTMLCanvasElement.prototype = setProxy(HTMLCanvasElement.prototype, "HTMLCanvasElement.prototype")
// GET 对象: window 属性名称: screen 属性类型: string 属性值类型: undefined
// GET 对象: window 属性名称: document 属性类型: string 属性值类型: undefined
window.screen = setProxy({
"availWidth": 1920,
"availHeight": 1032,
"width": 1920,
"height": 1080,
"colorDepth": 24,
"pixelDepth": 24,
"availLeft": 0,
"availTop": 0,
"orientation": {},
"onchange": null,
"isExtended": false
}, "screen")
document = setProxy({}, "document")
// GET 对象: document 属性名称: createElement 属性类型: string 属性值类型: undefined
function createElement() {
if (arguments[0] == "canvas") {
return setProxy(new HTMLCanvasElement(), "canvas")
}
}
document.createElement = setProxy(createElement, "createElement")
document.cookie = `UBT_VID=1744431254849.85ablPcB2kon; ibu_online_jump_site_result={"site_url":[],"suggestion":["zh-hk","","en-us","es-us","zh-cn"]}; ibu_online_home_language_match={"isRedirect":false,"isShowSuggestion":true,"lastVisited":true,"region":"us","redirectSymbol":false}; ibulanguage=HK; ibulocale=zh_hk; cookiePricesDisplayed=HKD; ibu_country=HK; _abtest_userid=2fd77317-cc39-4dcc-9038-76c6f7493783; ubtc_trip_pwa=0; trip_test_cookie=1; _tp_search_latest_channel_name=hotels; _gid=GA1.2.84396873.1744431375; _gcl_au=1.1.1697044261.1744431375; _ga_37RNVFDP1J=GS1.2.1744431374.1.0.1744431374.60.0.0; _RF1=2607%3Af130%3A0%3A145%3A%3Aced2%3A8326; _RSG=clKTvmNFtMCTHb_thUXePA; _RDG=28aaf788a9cdb021c33614655dee199a7a; _RGUID=c5b73d7c-3975-4be6-a668-85eaf7fe545d; _fwb=2547CjFiq9D3szhElOgHABm.1744431375477; _tt_enable_cookie=1; _ttp=01JRM3CSQNWRNPGN3HSA7893ZC_.tt.1; GUID=09034022116582083732; nfes_isSupportWebP=1; nfes_isSupportWebP=1; trn_traffic_start=10650138510; trn_traffic_end=10650138510; IBU_TRANCE_LOG_P=57985476762; devicePixelRatio=1; ibu_hotel_search_date=%7B%22checkIn%22%3A%222025%2F05%2F05%22%2C%22checkOut%22%3A%222025%2F05%2F06%22%7D; ibu_hotel_search_target=%7B%22countryId%22%3A1%2C%22provinceId%22%3A0%2C%22searchWord%22%3A%22%E6%B7%B1%E5%9C%B3%22%2C%22cityId%22%3A30%2C%22searchType%22%3A%22CT%22%7D; ibu_hotel_search_crn_guest=%7B%22adult%22%3A%222%22%2C%22children%22%3A%220%22%2C%22ages%22%3A%22%22%2C%22crn%22%3A%221%22%7D; oldLocale=zh-HK; _bfa=1.1744431254849.85ablPcB2kon.1.1744431397340.1744431436872.1.5.10320668148; IBU_showtotalamt=0; wcs_bt=s_33fb334966e9:1744431440; _uetsid=ebe78530175411f08f1fd74484c7d548; _uetvid=ebe7a530175411f0855065bba8033985; _ga=GA1.1.1748775873.1744431375; _ga_2DCSB93KS4=GS1.2.1744431375.1.1.1744431441.59.0.0; ttcsid=1744431376120.1.1744431441548; ttcsid_CIR4RVBC77UD5V58BBNG=1744431376120.1.1744431441772; _fbp=fb.1.1744431442200.97390564140526088; _ga_X437DZ73MR=GS1.1.1744431374.1.1.1744431455.40.0.0`
window.location = setProxy({
"ancestorOrigins": {},
"href": "https://hk.trip.com/hotels/list?city=30&cityName=%E6%B7%B1%E5%9C%B3&provinceId=0&countryId=1&districtId=0&checkin=2025%2F05%2F05&checkout=2025%2F05%2F06&lowPrice=0&highPrice=-1&barCurr=HKD&searchType=CT&searchWord=%E6%B7%B1%E5%9C%B3&crn=1&adult=2&children=0&searchBoxArg=t&travelPurpose=0&ctm_ref=ix_sb_dl&domestic=true&listFilters=29%7C1*29*1%7C2*2&locale=zh-HK&curr=HKD",
"origin": "https://hk.trip.com",
"protocol": "https:",
"host": "hk.trip.com",
"hostname": "hk.trip.com",
"port": "",
"pathname": "/hotels/list",
"search": "?city=30&cityName=%E6%B7%B1%E5%9C%B3&provinceId=0&countryId=1&districtId=0&checkin=2025%2F05%2F05&checkout=2025%2F05%2F06&lowPrice=0&highPrice=-1&barCurr=HKD&searchType=CT&searchWord=%E6%B7%B1%E5%9C%B3&crn=1&adult=2&children=0&searchBoxArg=t&travelPurpose=0&ctm_ref=ix_sb_dl&domestic=true&listFilters=29%7C1*29*1%7C2*2&locale=zh-HK&curr=HKD",
"hash": ""
}, "location")
require("./trip_jsvmp.js")
let data = {
"guideLogin": "T",
"search": {
"sessionId": "b69a5496-f1c0-d7d5-5fa0-2f1ce455278b",
"preHotelCount": 22,
"preHotelIds": [
81266091,
115996086,
345032,
100589920,
102556928,
115825601,
111774115,
97711372,
34998429,
66684700,
1066167,
371233,
120441830,
371239,
124181124,
99435980,
114925292,
70797786,
345037,
103066319,
54506880,
456133
],
"checkIn": "20250505",
"checkOut": "20250506",
"sourceFromTag": "",
"filters": [
{
"filterId": "29|1",
"type": "29",
"value": "1|2",
"subType": "2"
},
{
"filterId": "17|1",
"type": "17",
"value": "1",
"subType": "2"
},
{
"filterId": "80|0|1",
"type": "80",
"value": "0",
"subType": "2"
}
],
"pageCode": 10320668148,
"location": {
"geo": {
"countryID": 1,
"provinceID": 0,
"cityID": 30,
"districtID": 0,
"oversea": false
},
"coordinates": []
},
"pageIndex": 3,
"pageSize": 10,
"needTagMerge": "T",
"roomQuantity": 1,
"orderFieldSelectedByUser": false,
"hotelId": 0,
"hotelIds": [],
"lat": 22.52707770864266,
"lng": 114.05988082026357,
"tripWalkDriveSwitch": "T",
"resultType": "CT",
"nearbyHotHotel": {},
"recommendTimes": 0,
"crossPromotionId": "",
"travellingForWork": false
},
"batchRefresh": {
"batchId": "",
"batchSeqNo": 0
},
"queryTag": "NORMAL",
"mapType": "GOOGLE",
"extends": {
"crossPriceConsistencyLog": "",
"NewTaxDescForAmountshowtype0": "B",
"TaxDescForAmountshowtype2": "T",
"MealTagDependOnMealType": "T",
"MultiMainHotelPics": "T",
"enableDynamicRefresh": "T",
"isFirstDynamicRefresh": "T",
"ExposeBedInfos": "F",
"TaxDescRemoveRoomNight": "",
"priceMaskLoginTip": "",
"NeedHotelHighLight": "T"
},
"head": {
"platform": "PC",
"clientId": "1744431254849.85ablPcB2kon",
"bu": "ibu",
"group": "TRIP",
"aid": "",
"sid": "",
"ouid": "",
"caid": "",
"csid": "",
"couid": "",
"region": "HK",
"locale": "zh-HK",
"timeZone": "8",
"currency": "HKD",
"p": "57985476762",
"pageID": "10320668148",
"deviceID": "PC",
"clientVersion": "0",
"frontend": {
"vid": "1744431254849.85ablPcB2kon",
"sessionID": "1",
"pvid": "5"
},
"extension": [
{
"name": "cityId",
"value": "30"
},
{
"name": "checkIn",
"value": "2025/05/05"
},
{
"name": "checkOut",
"value": "2025/05/06"
},
{
"name": "region",
"value": "HK"
}
],
"tripSub1": "",
"qid": "643283145830",
"pid": "1a158e7b-2eda-49c7-a5dc-9183da100bbe",
"hotelExtension": {},
"cid": "1744431254849.85ablPcB2kon",
"traceLogID": "b906689e1d8dd",
"ticket": "",
"href": "https://hk.trip.com/hotels/list?city=30&cityName=%E6%B7%B1%E5%9C%B3&provinceId=0&countryId=1&districtId=0&checkin=2025%2F05%2F05&checkout=2025%2F05%2F06&lowPrice=0&highPrice=-1&barCurr=HKD&searchType=CT&searchWord=%E6%B7%B1%E5%9C%B3&crn=1&adult=2&children=0&searchBoxArg=t&travelPurpose=0&ctm_ref=ix_sb_dl&domestic=true&listFilters=29%7C1*29*1%7C2*2&locale=zh-HK&curr=HKD",
"deviceConfig": "L"
}
}
let O = window.signature(data);
console.log(O.length, O);
fetch("https://hk.trip.com/htls/getHotelListDynamicRefresh?x-traceID=1744431254849.85ablPcB2kon-1744431816849-1887382392", {
"headers": {
"accept": "application/json",
"accept-language": "zh-CN,zh;q=0.9",
"cache-control": "no-cache",
"content-type": "application/json",
"currency": "HKD",
"locale": "zh-HK",
"p": "57985476762",
"phantom-token": O,
"pragma": "no-cache",
"priority": "u=1, i",
"sec-ch-ua": "\"Microsoft Edge\";v=\"135\", \"Not-A.Brand\";v=\"8\", \"Chromium\";v=\"135\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"trip-trace-id": "1744431254849.85ablPcB2kon-1744431816849-1887382392",
"x-traceid": "1744431254849.85ablPcB2kon-1744431816849-1887382392",
"cookie": "UBT_VID=1744431254849.85ablPcB2kon; ibu_online_jump_site_result={\"site_url\":[],\"suggestion\":[\"zh-hk\",\"\",\"en-us\",\"es-us\",\"zh-cn\"]}; ibu_online_home_language_match={\"isRedirect\":false,\"isShowSuggestion\":true,\"lastVisited\":true,\"region\":\"us\",\"redirectSymbol\":false}; ibulanguage=HK; ibulocale=zh_hk; cookiePricesDisplayed=HKD; ibu_country=HK; _abtest_userid=2fd77317-cc39-4dcc-9038-76c6f7493783; ubtc_trip_pwa=0; trip_test_cookie=1; _tp_search_latest_channel_name=hotels; _gid=GA1.2.84396873.1744431375; _gcl_au=1.1.1697044261.1744431375; _ga_37RNVFDP1J=GS1.2.1744431374.1.0.1744431374.60.0.0; _RF1=2607%3Af130%3A0%3A145%3A%3Aced2%3A8326; _RSG=clKTvmNFtMCTHb_thUXePA; _RDG=28aaf788a9cdb021c33614655dee199a7a; _RGUID=c5b73d7c-3975-4be6-a668-85eaf7fe545d; _fwb=2547CjFiq9D3szhElOgHABm.1744431375477; _tt_enable_cookie=1; _ttp=01JRM3CSQNWRNPGN3HSA7893ZC_.tt.1; GUID=09034022116582083732; nfes_isSupportWebP=1; _resDomain=https%3A%2F%2Fak-s-cw.tripcdn.com; nfes_isSupportWebP=1; trn_traffic_start=10650138510; trn_traffic_end=10650138510; IBU_TRANCE_LOG_P=57985476762; devicePixelRatio=1; ibu_hotel_search_date=%7B%22checkIn%22%3A%222025%2F05%2F05%22%2C%22checkOut%22%3A%222025%2F05%2F06%22%7D; ibu_hotel_search_target=%7B%22countryId%22%3A1%2C%22provinceId%22%3A0%2C%22searchWord%22%3A%22%E6%B7%B1%E5%9C%B3%22%2C%22cityId%22%3A30%2C%22searchType%22%3A%22CT%22%7D; ibu_hotel_search_crn_guest=%7B%22adult%22%3A%222%22%2C%22children%22%3A%220%22%2C%22ages%22%3A%22%22%2C%22crn%22%3A%221%22%7D; oldLocale=zh-HK; _bfa=1.1744431254849.85ablPcB2kon.1.1744431397340.1744431436872.1.5.10320668148; IBU_showtotalamt=0; wcs_bt=s_33fb334966e9:1744431440; _uetsid=ebe78530175411f08f1fd74484c7d548; _uetvid=ebe7a530175411f0855065bba8033985; _ga=GA1.1.1748775873.1744431375; _ga_2DCSB93KS4=GS1.2.1744431375.1.1.1744431441.59.0.0; ttcsid=1744431376120.1.1744431441548; ttcsid_CIR4RVBC77UD5V58BBNG=1744431376120.1.1744431441772; _fbp=fb.1.1744431442200.97390564140526088; _ga_X437DZ73MR=GS1.1.1744431374.1.1.1744431455.40.0.0",
"Referer": "https://hk.trip.com/hotels/list?city=30&cityName=%E6%B7%B1%E5%9C%B3&provinceId=0&countryId=1&districtId=0&checkin=2025%2F05%2F05&checkout=2025%2F05%2F06&lowPrice=0&highPrice=-1&barCurr=HKD&searchType=CT&searchWord=%E6%B7%B1%E5%9C%B3&crn=1&adult=2&children=0&searchBoxArg=t&travelPurpose=0&ctm_ref=ix_sb_dl&domestic=true&listFilters=29%7C1*29*1%7C2*2&locale=zh-HK&curr=HKD",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"body": JSON.stringify(data),
"method": "POST"
}).then((response) => {
return response.json()
}).then((data) => {
console.log(JSON.stringify(data));
}).catch((err) => {
console.log(err);
})