Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -124,40 +124,10 @@ app.get("/api/direct", async (req, res) => {
|
|
| 124 |
|
| 125 |
const cookies = await page.cookies();
|
| 126 |
const cookieHeader = cookies.map(c => `${c.name}=${c.value}`).join("; ");
|
| 127 |
-
|
| 128 |
-
const response = await fetch(intermediate, {
|
| 129 |
-
method: "GET",
|
| 130 |
-
redirect: "auto",
|
| 131 |
-
headers: {
|
| 132 |
-
"cookie": cookieHeader,
|
| 133 |
-
"authority": "wildshare.net",
|
| 134 |
-
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
| 135 |
-
"accept-encoding": "gzip, deflate, br, zstd",
|
| 136 |
-
"accept-language": "en-US,en;q=0.9",
|
| 137 |
-
"priority": "u=0, i",
|
| 138 |
-
"referer": url,
|
| 139 |
-
"sec-ch-ua": "\"Not;A=Brand\";v=\"99\", \"Google Chrome\";v=\"139\", \"Chromium\";v=\"139\"",
|
| 140 |
-
"sec-ch-ua-mobile": "?0",
|
| 141 |
-
"sec-ch-ua-platform": "\"Windows\"",
|
| 142 |
-
"sec-fetch-dest": "document",
|
| 143 |
-
"sec-fetch-mode": "navigate",
|
| 144 |
-
"sec-fetch-site": "same-origin",
|
| 145 |
-
"sec-fetch-user": "?1",
|
| 146 |
-
"upgrade-insecure-requests": "1",
|
| 147 |
-
"user-agent":
|
| 148 |
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36",
|
| 149 |
-
}
|
| 150 |
-
});
|
| 151 |
-
console.log(response.headers)
|
| 152 |
-
const finalUrl = response.headers.get("location");
|
| 153 |
-
if (!finalUrl) {
|
| 154 |
-
return res.status(500).json({ status: false, error: "Final URL not found" });
|
| 155 |
-
}
|
| 156 |
|
| 157 |
res.json({
|
| 158 |
status: true,
|
| 159 |
-
|
| 160 |
-
direct: finalUrl
|
| 161 |
});
|
| 162 |
|
| 163 |
} catch (err) {
|
|
|
|
| 124 |
|
| 125 |
const cookies = await page.cookies();
|
| 126 |
const cookieHeader = cookies.map(c => `${c.name}=${c.value}`).join("; ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
res.json({
|
| 129 |
status: true,
|
| 130 |
+
cookieHeader
|
|
|
|
| 131 |
});
|
| 132 |
|
| 133 |
} catch (err) {
|