cfoo commited on
Update index.js
Browse files
index.js
CHANGED
|
@@ -15,16 +15,17 @@ app.all('/', async (req, res) => {
|
|
| 15 |
while (!success && count < 10) {
|
| 16 |
try {
|
| 17 |
// Fetch the cookies from the given URL
|
| 18 |
-
let response = await axios.get('https://
|
| 19 |
//let response = await axios.get('https://bing.cf03-b29.workers.dev/turing/captcha/challenge');
|
| 20 |
// Set the success flag to true
|
| 21 |
success = true;
|
| 22 |
// Get the cookies from the response header
|
| 23 |
let cookies = response.headers['set-cookie'];
|
| 24 |
// Remove all the "Path=/" from the cookies
|
| 25 |
-
cookies = cookies.map(cookie => cookie.replace('Path=/', ''));
|
| 26 |
// Join the cookies with semicolons
|
| 27 |
-
cookies = cookies.join('; ');
|
|
|
|
| 28 |
// Return the cookies as the body of the response
|
| 29 |
res.send(cookies); // 这里使用res.send方法,而不是res.json方法
|
| 30 |
} catch (error) {
|
|
|
|
| 15 |
while (!success && count < 10) {
|
| 16 |
try {
|
| 17 |
// Fetch the cookies from the given URL
|
| 18 |
+
let response = await axios.get('https://getcaptcha.nbing.eu.org/turing/captcha/challenge');
|
| 19 |
//let response = await axios.get('https://bing.cf03-b29.workers.dev/turing/captcha/challenge');
|
| 20 |
// Set the success flag to true
|
| 21 |
success = true;
|
| 22 |
// Get the cookies from the response header
|
| 23 |
let cookies = response.headers['set-cookie'];
|
| 24 |
// Remove all the "Path=/" from the cookies
|
| 25 |
+
//cookies = cookies.map(cookie => cookie.replace('Path=/', ''));
|
| 26 |
// Join the cookies with semicolons
|
| 27 |
+
//cookies = cookies.join('; ');
|
| 28 |
+
cookies = cookies.map(cookie => cookie.split(';')[0]).join(';');
|
| 29 |
// Return the cookies as the body of the response
|
| 30 |
res.send(cookies); // 这里使用res.send方法,而不是res.json方法
|
| 31 |
} catch (error) {
|