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 }