lix02 commited on
Commit
c88d075
·
verified ·
1 Parent(s): 67f9110

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +12 -2
index.js CHANGED
@@ -62,15 +62,25 @@ app.get('/*', async (req, res) => {
62
 
63
  console.log(result.cibname); // 在此处输出 htmlContent
64
 
65
- // 判断访问路径
66
  if (req.path === '/html') {
67
  res.set('Content-Type', 'text/html');
68
  res.send(result.htmlContent); // 发送 htmlContent 的纯文本响应
 
 
 
 
 
 
 
 
 
 
69
  } else {
70
  res.set('Content-Type', 'text/plain');
71
  res.send(result.scripts); // 发送 scripts 的纯文本响应
72
  }
73
-
74
  // 关闭浏览器
75
  await browser.close();
76
 
 
62
 
63
  console.log(result.cibname); // 在此处输出 htmlContent
64
 
65
+ // 判断访问路径
66
  if (req.path === '/html') {
67
  res.set('Content-Type', 'text/html');
68
  res.send(result.htmlContent); // 发送 htmlContent 的纯文本响应
69
+ } else if (req.path === '/core') {
70
+ const coreContent = result.htmlContent.match(/\[CDATA\[\(function\(n,t\)\{onload=function\(\)\{_G\.BPT=new Date;n&&n\(\)\{(.*?)\/\/\]\]/s);
71
+ if (coreContent) {
72
+ const extractedString = coreContent[1].replace(/https:\/\/r\.bing\.com\/rp\//g, 'https://sokwith-proxybing.hf.space/rp/');
73
+ res.set('Content-Type', 'text/plain');
74
+ res.send(extractedString); // 发送提取后的字符串
75
+ } else {
76
+ res.set('Content-Type', 'text/plain');
77
+ res.send('没有找到匹配的字符串');
78
+ }
79
  } else {
80
  res.set('Content-Type', 'text/plain');
81
  res.send(result.scripts); // 发送 scripts 的纯文本响应
82
  }
83
+
84
  // 关闭浏览器
85
  await browser.close();
86