feat: 飞猪脚本调试
This commit is contained in:
4
src/main/scripts/dy_trace.mjs
Normal file
4
src/main/scripts/dy_trace.mjs
Normal file
@@ -0,0 +1,4 @@
|
||||
import log from 'electron-log';
|
||||
|
||||
log.info('dy_trace.mjs placeholder: not implemented');
|
||||
process.exit(0);
|
||||
@@ -102,6 +102,33 @@ const checkLoginStatus = async (page) => {
|
||||
await page.waitForTimeout(4000 + Math.random() * 1000);
|
||||
await page.getByText('房价房量日历').click();
|
||||
|
||||
// 获取网页接口(监听所有请求)
|
||||
await page.on('request', response => {
|
||||
const url = response.url()
|
||||
|
||||
// log.info('request response:', url)
|
||||
|
||||
if (url.includes('/heinventory/queryRoomTypeAndRatePlanLite')) {
|
||||
// const data = await response.json()
|
||||
|
||||
log.info('interface response:', JSON.parse(response.postData()))
|
||||
}
|
||||
// log.info('URL:', request.url())
|
||||
// log.info('Method:', request.method())
|
||||
// log.info('PostData:', request.postData())
|
||||
})
|
||||
|
||||
// 获取接口返回数据
|
||||
await page.on('response', async (response) => {
|
||||
const url = response.url()
|
||||
|
||||
if (url.includes('/heinventory/queryRoomTypeAndRatePlanLite')) {
|
||||
const data = await response.json()
|
||||
|
||||
log.info('interface response:', data)
|
||||
}
|
||||
})
|
||||
|
||||
// await page.pause();
|
||||
/*
|
||||
* 1、我要知道日期
|
||||
|
||||
4
src/main/scripts/mt_trace.mjs
Normal file
4
src/main/scripts/mt_trace.mjs
Normal file
@@ -0,0 +1,4 @@
|
||||
import log from 'electron-log';
|
||||
|
||||
log.info('mt_trace.mjs placeholder: not implemented');
|
||||
process.exit(0);
|
||||
4
src/main/scripts/xc_trace.mjs
Normal file
4
src/main/scripts/xc_trace.mjs
Normal file
@@ -0,0 +1,4 @@
|
||||
import log from 'electron-log';
|
||||
|
||||
log.info('xc_trace.mjs placeholder: not implemented');
|
||||
process.exit(0);
|
||||
Reference in New Issue
Block a user