Update index.js
Browse files
index.js
CHANGED
@@ -80,6 +80,16 @@ app.get('/*', async (req, res) => {
|
|
80 |
extractedString = extractedString.replace(/https:\\\/\\\/r\.bing\.com/g, ''); // 删除 https:\/\/r.bing.com 字符串
|
81 |
res.set('Content-Type', 'text/plain');
|
82 |
res.send(extractedString); // 发送提取后的字符串
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
} else {
|
84 |
res.set('Content-Type', 'text/plain');
|
85 |
res.send('没有找到Core匹配的字符串');
|
|
|
80 |
extractedString = extractedString.replace(/https:\\\/\\\/r\.bing\.com/g, ''); // 删除 https:\/\/r.bing.com 字符串
|
81 |
res.set('Content-Type', 'text/plain');
|
82 |
res.send(extractedString); // 发送提取后的字符串
|
83 |
+
} else if (req.path === '/importmap') {
|
84 |
+
// 提取以 <script type="importmap" nonce=""> 开始,以 </script> 结尾的字符串
|
85 |
+
const importmapContent = result.htmlContent.match(/<script type="importmap" nonce="">.*?<\/script>/s);
|
86 |
+
if (importmapContent) {
|
87 |
+
res.set('Content-Type', 'text/plain');
|
88 |
+
res.send(importmapContent[0]); // 发送提取后的字符串
|
89 |
+
} else {
|
90 |
+
res.set('Content-Type', 'text/plain');
|
91 |
+
res.send('没有找到map匹配的字符串');
|
92 |
+
}
|
93 |
} else {
|
94 |
res.set('Content-Type', 'text/plain');
|
95 |
res.send('没有找到Core匹配的字符串');
|