jokyone commited on
Commit
a0baccd
·
verified ·
1 Parent(s): 28ccf2c

Delete resultindex.js

Browse files
Files changed (1) hide show
  1. resultindex.js +0 -46
resultindex.js DELETED
@@ -1,46 +0,0 @@
1
- // Import the modules
2
- const express = require('express');
3
- const axios = require('axios');
4
-
5
- // Create an express app
6
- const app = express();
7
-
8
- // Define a route for the root path
9
- app.all('/', async (req, res) => {
10
- // Initialize a counter for the loop
11
- let count = 0;
12
- // Initialize a flag for the success
13
- let success = false;
14
- // Loop until success or 10 times
15
- while (!success && count < 10) {
16
- try {
17
- // Fetch the cookies from the given URL
18
- let response = await axios.get('https://proxybing.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
- // Create a JSON object with the cookies as a property
29
- let result = {result: {cookies: cookies}};
30
- // Return the JSON object as the body of the response
31
- res.json(result);
32
- } catch (error) {
33
- // Increment the counter
34
- count++;
35
- }
36
- }
37
- // If the loop ends without success, return an error message
38
- if (!success) {
39
- res.status(500).send('Failed to get cookies');
40
- }
41
- });
42
-
43
- // Run the express app, listen on port 7860
44
- app.listen(7860, () => {
45
- console.log('App is running on port 7860');
46
- });