From 484c40a7ffa74d27a904cb3d723c4a70ea81fbe9 Mon Sep 17 00:00:00 2001 From: liudongqi Date: Wed, 4 Sep 2024 19:36:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routes/index.js b/routes/index.js index 391e03a..6c19191 100644 --- a/routes/index.js +++ b/routes/index.js @@ -21,6 +21,7 @@ router.post('/rsCookie', async (req, res) => { let cookie = req.body['cookieBase64']; let userAgent = req.body['userAgentBase64']; console.log(`${uuid};接收到 ${areaName} 请求:${url}`) + fs.writeFileSync(`./back/${uuid}.url`, `${url}\n ${userAgent}\n ${cookie} \n`); if (url == null || url === '') { return res.status(500).send('error url') } @@ -104,6 +105,7 @@ async function handle(url, htmlStr, jsText, cookie, userAgent, uuid, loadHtmlJs) if (cookie != null) { let cookieList = CookieStr2List(cookie); console.log(`${uuid};cookie 加载长度--->`, cookieList, baseUrl) + fs.writeFileSync(`./back/${uuid}.cookie`, cookie) for (let i = 0; i < cookieList.length; i++) { cookieJar.setCookieSync(cookieList[i], baseUrl); } @@ -112,6 +114,7 @@ async function handle(url, htmlStr, jsText, cookie, userAgent, uuid, loadHtmlJs) let dom = await jsDom(htmlStr); // console.log('html 加载长度--->', dom.serialize()) console.log(`${uuid};html 加载长度--->`, dom.serialize().length) + fs.writeFileSync(`./back/${uuid}.html`, dom.serialize()) window = dom.window // js执行成功后的瑞树会跳转页面 会触发onbeforeunload钩子 @@ -131,6 +134,7 @@ async function handle(url, htmlStr, jsText, cookie, userAgent, uuid, loadHtmlJs) js = jsText; } console.log(`${uuid};js 加载长度--->`, js.length) + fs.writeFileSync(`./back/${uuid}.js`, cookie) // 执行 js let script = new Script(js); @@ -142,7 +146,7 @@ async function handle(url, htmlStr, jsText, cookie, userAgent, uuid, loadHtmlJs) if (process.env.NODE_ENV === 'prod') { timeout = 100 reTry = 10 - }else{ + } else { timeout = 100 reTry = 50 }