feat: 飞猪脚本调试
This commit is contained in:
@@ -14,13 +14,13 @@ export function runTaskOperationService() {
|
|||||||
try {
|
try {
|
||||||
await launchLocalChrome(options)
|
await launchLocalChrome(options)
|
||||||
|
|
||||||
const channels = ['feizhu', 'meituan', 'douyin', 'xiaocheng']
|
const channels = ['fz', 'mt', 'dy', 'xc']
|
||||||
|
|
||||||
const scriptMap: Record<string, string> = {
|
const scriptMap: Record<string, string> = {
|
||||||
feizhu: 'fg_trace.mjs',
|
fz: 'fg_trace.mjs',
|
||||||
meituan: 'mt_trace.mjs',
|
mt: 'mt_trace.mjs',
|
||||||
douyin: 'dy_trace.mjs',
|
dy: 'dy_trace.mjs',
|
||||||
xiaocheng: 'xc_trace.mjs',
|
xc: 'xc_trace.mjs',
|
||||||
}
|
}
|
||||||
|
|
||||||
const scriptsDir = app.isPackaged
|
const scriptsDir = app.isPackaged
|
||||||
|
|||||||
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.waitForTimeout(4000 + Math.random() * 1000);
|
||||||
await page.getByText('房价房量日历').click();
|
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();
|
// await page.pause();
|
||||||
/*
|
/*
|
||||||
* 1、我要知道日期
|
* 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