|
@@ -19,9 +19,12 @@ function updateHeaders() {
|
|
|
|
|
|
async function trySearch() {
|
|
|
let total = 100;
|
|
|
+ let keyword = 'iphone 15 pro';
|
|
|
+ let expectVer = 'iOS 17.0';
|
|
|
+ magicJS.logger.info(`开始搜索...`);
|
|
|
for (let i = 1; i <= total; i++) {
|
|
|
magicJS.logger.info(`[0]搜索进度${i}/${total}`);
|
|
|
- let retSearch = await doSearch("iphone 15 pro", i);
|
|
|
+ let retSearch = await doSearch(keyword, i);
|
|
|
if (retSearch.respCode != '0') {
|
|
|
continue;
|
|
|
}
|
|
@@ -29,8 +32,14 @@ async function trySearch() {
|
|
|
magicJS.logger.info(`[1]搜索进度${i}/${total}`);
|
|
|
let infos = respData.infos;
|
|
|
magicJS.logger.info(`[2]搜索结果数:${infos.length}`);
|
|
|
+ if (infos.length == 0) {
|
|
|
+ magicJS.logger.info(`结束搜索...`);
|
|
|
+ break;
|
|
|
+ }
|
|
|
for (let info of infos) {
|
|
|
- magicJS.logger.info(`infoId=${info.infoId}`);
|
|
|
+ const priceInfo = info.priceInfo;
|
|
|
+ magicJS.logger.info(`${info.title}(${priceInfo.currencyType}${priceInfo.priceText})`);
|
|
|
+ magicJS.logger.info(`商品ID:${info.infoId}`);
|
|
|
if (info.infoId == void 0) {
|
|
|
continue;
|
|
|
}
|
|
@@ -40,9 +49,9 @@ async function trySearch() {
|
|
|
let itemId2AttrInfo = report.itemId2AttrInfo;
|
|
|
// magicJS.logger.info(`itemId2AttrInfo=${JSON.stringify(itemId2AttrInfo)}`);
|
|
|
if (itemId2AttrInfo) {
|
|
|
- let matchRet = checkOSVersionLow(itemId2AttrInfo, 'iOS 17.0');
|
|
|
- if (matchRet) {
|
|
|
- magicJS.logger.info(`匹配到${JSON.stringify(matchRet)}`);
|
|
|
+ let retVerMate = checkOSVersionLow(itemId2AttrInfo, expectVer);
|
|
|
+ if (retVerMate != null) {
|
|
|
+ magicJS.logger.info(`匹配成功,请前往查看\n${info.jumpUrl}`);
|
|
|
await addLoveInfo(info.infoId);
|
|
|
}
|
|
|
}
|
|
@@ -87,8 +96,10 @@ function compareVersions(version1, version2) {
|
|
|
|
|
|
async function doSearch(keyword, pagenum = 1, pagesize = 20) {
|
|
|
const url = `https://app.zhuanzhuan.com/zz/transfer/search`;
|
|
|
+ const zzReqSign = 'b55c49a472a21c2bea40c7914ae867a2';
|
|
|
+ const zzReqT = `1736317145000`;
|
|
|
const headers = {
|
|
|
- 'zzReqT': `1736142162000`,
|
|
|
+ 'zzReqT': zzReqT,
|
|
|
'Csrf-Token': `12921dc6df40d814575bb84e16f2ac148129ceed`,
|
|
|
'Accept-Encoding': `gzip,deflate`,
|
|
|
'zzreferer': `https://app.zhuanzhuan.com/zz/16/E1007`,
|
|
@@ -96,66 +107,89 @@ async function doSearch(keyword, pagenum = 1, pagesize = 20) {
|
|
|
'X-ZZ-Monitoring-Metrics': `feMetricAntiCheatLevel=V1`,
|
|
|
'Content-Type': `application/x-www-form-urlencoded`,
|
|
|
'zztk': ``,
|
|
|
- 'zzReqSign': `2816d141f43575910e66212e51194563`,
|
|
|
+ 'zzReqSign': zzReqSign,
|
|
|
'zzht': `i_16`,
|
|
|
'User-Agent': `zhuanzhuan/11.6.0 (iPhone; iOS 18.2; Scale/3.00)`,
|
|
|
- 'Cookie': `dualTrackFinenessAbRaw=A;platformUpgradeRaw=9311;tk=70c64fd1ab35b08360a02901c03abb4758a15705;platformUpgradeLuxin=3;PPU="TT=12921dc6df40d814575bb84e16f2ac148129ceed&UID=100535294213798016&CT=1736141595202&SF=ZHUANZHUAN&SCT=1736145195202&V=2&ET=1738733595202&AP=16"; Version=1; Domain=zhuanzhuan.com; Max-Age=2592000; Expires=Wed, 05-Feb-2025 05:33:15 GMT;;brandUpgradeAB=0;lon=0.000000;brand=Apple;t=16;sts=1736141595142;platformUpgradeYumi=1;feedRecommendation=0;v=11.6.0;dualTrackFinenessAbSwitch=0;officialVerifyUnifyAB=C;zz_t=16;uid=100535294213798016;Safe-PPU="TT=12921dc6df40d814575bb84e16f2ac148129ceed&UID=100535294213798016&CT=1736141595202&SF=ZHUANZHUAN&SCT=1736145195202&V=2&ET=1738733595202&AP=16"; Version=1; Domain=zhuanzhuan.com; Max-Age=2592000; Expires=Wed, 05-Feb-2025 05:33:15 GMT;;request_remove_latlon=0;model=iPhone15%2C2;lat=0.000000;platformUpgradeSwitch=1;`,
|
|
|
+ 'Cookie': `dualTrackFinenessAbRaw=A;platformUpgradeRaw=9311;tk=70c64fd1ab35b08360a02901c03abb4758a15705;platformUpgradeLuxin=3;PPU="TT=7c1415beec5efd6007c0e89a5a644898685fd37d&UID=100535294213798016&CT=1736317010829&SF=ZHUANZHUAN&SCT=1736320610829&V=2&ET=1738909010829&AP=16"; Version=1; Domain=zhuanzhuan.com; Max-Age=2592000; Expires=Fri, 07-Feb-2025 06:16:50 GMT;;brandUpgradeAB=0;lon=0.000000;brand=Apple;t=16;sts=1736317010827;platformUpgradeYumi=1;feedRecommendation=0;v=11.6.1;dualTrackFinenessAbSwitch=0;officialVerifyUnifyAB=C;zz_t=16;uid=100535294213798016;Safe-PPU="TT=7c1415beec5efd6007c0e89a5a644898685fd37d&UID=100535294213798016&CT=1736317010829&SF=ZHUANZHUAN&SCT=1736320610829&V=2&ET=1738909010829&AP=16"; Version=1; Domain=zhuanzhuan.com; Max-Age=2592000; Expires=Fri, 07-Feb-2025 06:16:50 GMT;;request_remove_latlon=0;model=iPhone15%2C2;lat=0.000000;platformUpgradeSwitch=1;`,
|
|
|
'Host': `app.zhuanzhuan.com`,
|
|
|
- 'zzReqAllParam': `sessionStr|searcfilterhmove2zzsearch|searchStandardPropertiesAB|searchPageSource|keyword|usePgParam|pagesize|zzReqT|serviceId|verticalAbTest|requestmark|pageIdParams|pagenum|searchsuggestcate|pushcode|searchRecommendRankAB|filterModuleServerParamsInput|search_9_0_0|zztk|v7abtest|changeIntention|recModelAB|searchfrom|searchAccurateFilterAB|b2cInfoCardAB`,
|
|
|
+ 'zzReqAllParam': `sessionStr|tabId|searcfilterhmove2zzsearch|searchStandardPropertiesAB|searchPageSource|keyword|usePgParam|pagesize|zzReqT|serviceId|verticalAbTest|requestmark|pageIdParams|pagenum|searchsuggestcate|pushcode|searchRecommendRankAB|filterModuleServerParamsInput|search_9_0_0|zztk|v7abtest|changeIntention|recModelAB|searchfrom|searchAccurateFilterAB|b2cInfoCardAB`,
|
|
|
'Referer': `https://app.zhuanzhuan.com/zz/16/E1007`,
|
|
|
'Accept-Language': `zh-Hans-CN;q=1`,
|
|
|
'Accept': `*/*`
|
|
|
};
|
|
|
let filterModuleServerParamsInput = {
|
|
|
+ "keyword": keyword,
|
|
|
"searchScene": 1,
|
|
|
+ "tab": "0",
|
|
|
"scene": 1,
|
|
|
"filterModuleParam": {
|
|
|
"version": "1.7.0",
|
|
|
"appType": "2"
|
|
|
},
|
|
|
- "keyword": keyword
|
|
|
+ "clickItems": {
|
|
|
+ "365": [
|
|
|
+ {
|
|
|
+ "value": "12632",
|
|
|
+ "cmd": "params_new10491=1080730",
|
|
|
+ "style": "201"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "value": "12616",
|
|
|
+ "cmd": "params_new10491=1081373",
|
|
|
+ "style": "201"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "st7": [
|
|
|
+ {
|
|
|
+ "value": "sp00",
|
|
|
+ "cmd": "sortpolicy=0",
|
|
|
+ "style": "320"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
};
|
|
|
let pageIdParams = {
|
|
|
- "refpagequery": "from=1",
|
|
|
- "refpagetype": "V1008",
|
|
|
+ "refpagequery": "",
|
|
|
+ "refpagetype": "E1007",
|
|
|
"refsubpageid": ""
|
|
|
};
|
|
|
let sessionData = {
|
|
|
- "abtest": "feedwords.base_feedwords_0407_base:flow_management_362.cgroup_flow_management_362:flow_management_405.agroup_flow_management_405:flow_management_407.agroup_flow_management_407:segment.base_segment_0412_base:sortstrategy.base_sortstrategy_0407_base:termrecalloff.termrecalloff0102",
|
|
|
+ "abtest": "feedwords.base_feedwords_0407_base:flow_management_362.cgroup_flow_management_362:flow_management_405.agroup_flow_management_405:flow_management_407.agroup_flow_management_407:flow_management_425.agroup_flow_management_425:flow_management_427.bgroup_flow_management_427:luxuryquerycatetop.base_luxuryquerycatetop0106_a2:segment.base_segment_0412_base:sortstrategy.base_sortstrategy_0407_base",
|
|
|
"session": "70c64fd1ab35b08360a02901c03abb4758a15705"
|
|
|
};
|
|
|
+
|
|
|
let postData = {
|
|
|
"b2cInfoCardAB": "B",
|
|
|
"changeIntention": "0",
|
|
|
- "filterModuleServerParamsInput": (JSON.stringify(filterModuleServerParamsInput)),
|
|
|
- "keyword": keyword,
|
|
|
- "pageIdParams": (JSON.stringify(pageIdParams)),
|
|
|
- "pagenum": String(pagenum),
|
|
|
- "pagesize": String(pagesize),
|
|
|
- "pushcode": "1",
|
|
|
+ "filterModuleServerParamsInput": encodeURIComponent(JSON.stringify(filterModuleServerParamsInput)),
|
|
|
+ "keyword": encodeURIComponent(keyword),
|
|
|
+ "pageIdParams": encodeURIComponent(JSON.stringify(pageIdParams)),
|
|
|
+ "pagenum": pagenum,
|
|
|
+ "pagesize": pagesize,
|
|
|
+ "pushcode": "1", //不一样
|
|
|
"recModelAB": "1",
|
|
|
- "requestmark": "1736142162130",
|
|
|
+ "requestmark": Date.now(),
|
|
|
"searcfilterhmove2zzsearch": "1",
|
|
|
"searchAccurateFilterAB": "2",
|
|
|
- "searchPageSource": "1",
|
|
|
+ "searchPageSource": "1",//不一样
|
|
|
"searchRecommendRankAB": "A",
|
|
|
"searchStandardPropertiesAB": "B",
|
|
|
"search_9_0_0": "B",
|
|
|
- "searchfrom": "1",
|
|
|
+ "searchfrom": "1",//不一样
|
|
|
"searchsuggestcate": "1",
|
|
|
"serviceId": "",
|
|
|
- "sessionStr": (JSON.stringify(sessionData)),
|
|
|
+ "sessionStr": encodeURIComponent(JSON.stringify(sessionData)),
|
|
|
+ "tabId": "0",
|
|
|
"usePgParam": "1",
|
|
|
"v7abtest": "1",
|
|
|
"verticalAbTest": ""
|
|
|
}
|
|
|
- let bodyText = magicJS.objToQueryStr(postData, true);
|
|
|
- // magicJS.logger.info(`bodyText=${bodyText}`);
|
|
|
- bodyText = `b2cInfoCardAB=B&changeIntention=0&filterModuleServerParamsInput=%7B%22searchScene%22%3A1%2C%22scene%22%3A1%2C%22filterModuleParam%22%3A%7B%22version%22%3A%221.7.0%22%2C%22appType%22%3A%222%22%7D%2C%22keyword%22%3A%22iphone%2015%20pro%22%7D&keyword=iphone%2015%20pro&pageIdParams=%7B%22refpagequery%22%3A%22from%3D1%22%2C%22refpagetype%22%3A%22V1008%22%2C%22refsubpageid%22%3A%22%22%7D&pagenum=1&pagesize=20&pushcode=1&recModelAB=1&requestmark=1736142162130&searcfilterhmove2zzsearch=1&searchAccurateFilterAB=2&searchPageSource=1&searchRecommendRankAB=A&searchStandardPropertiesAB=B&search_9_0_0=B&searchfrom=1&searchsuggestcate=1&serviceId=&sessionStr=%7B%22abtest%22%3A%22feedwords.base_feedwords_0407_base%3Aflow_management_362.cgroup_flow_management_362%3Aflow_management_405.agroup_flow_management_405%3Aflow_management_407.agroup_flow_management_407%3Asegment.base_segment_0412_base%3Asortstrategy.base_sortstrategy_0407_base%3Atermrecalloff.termrecalloff0102%22%2C%22session%22%3A%2270c64fd1ab35b08360a02901c03abb4758a15705%22%7D&usePgParam=1&v7abtest=1&verticalAbTest=`;
|
|
|
|
|
|
- bodyText = `b2cInfoCardAB=B&changeIntention=0&filterModuleServerParamsInput=%7B%22searchScene%22%3A1%2C%22scene%22%3A1%2C%22filterModuleParam%22%3A%7B%22version%22%3A%221.7.0%22%2C%22appType%22%3A%222%22%7D%2C%22keyword%22%3A%22iphone15%22%7D&keyword=iphone15&pageIdParams=%7B%22refpagequery%22%3A%22from%3D14%22%2C%22refpagetype%22%3A%22V1008%22%2C%22refsubpageid%22%3A%22%22%7D&pagenum=1&pagesize=20&pushcode=1071&recModelAB=1&requestmark=1736155352263&searcfilterhmove2zzsearch=1&searchAccurateFilterAB=2&searchRecommendRankAB=A&searchStandardPropertiesAB=B&search_9_0_0=B&searchfrom=1071&searchsuggestcate=1&serviceId=&sessionStr=%7B%22abtest%22%3A%22feedwords.base_feedwords_0407_base%3Aflow_management_362.cgroup_flow_management_362%3Aflow_management_405.agroup_flow_management_405%3Aflow_management_407.agroup_flow_management_407%3Asegment.base_segment_0412_base%3Asortstrategy.base_sortstrategy_0407_base%3Atermrecalloff.termrecalloff0102%22%2C%22session%22%3A%2270c64fd1ab35b08360a02901c03abb4758a15705%22%7D&usePgParam=1&v7abtest=1&verticalAbTest=`
|
|
|
- bodyText = bodyText.replace('requestmark=1736155352263', `requestmark=${Date.now()}`);
|
|
|
- bodyText = bodyText.replace('pagenum=1&pagesize=20', `pagenum=${pagenum}&pagesize=${pagesize}`);
|
|
|
+ let bodyText = magicJS.objToQueryStr(postData, false);
|
|
|
+ magicJS.logger.info(`bodyText=${bodyText}`);
|
|
|
+
|
|
|
+ // bodyText = bodyText.replace('requestmark=1736155352263', `requestmark=${Date.now()}`);
|
|
|
+ // bodyText = bodyText.replace('pagenum=1&pagesize=20', `pagenum=${pagenum}&pagesize=${pagesize}`);
|
|
|
let options = {
|
|
|
url: url,
|
|
|
headers: headers,
|