Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -115,15 +115,9 @@ app.get("/api/direct", async (req, res) => {
|
|
| 115 |
await page.goto(url, { waitUntil: "domcontentloaded", timeout: 60000 });
|
| 116 |
|
| 117 |
// Step 2: Extract the onclick link
|
| 118 |
-
const intermediate = await page.
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
const onclickAttr = btn.getAttribute("onclick");
|
| 122 |
-
if (!onclickAttr) return null;
|
| 123 |
-
const match = onclickAttr.match(/'(https?:\/\/[^']+)'/);
|
| 124 |
-
return match ? match[1] : null;
|
| 125 |
-
});
|
| 126 |
-
|
| 127 |
if (!intermediate) {
|
| 128 |
return res.status(404).json({ status: false, error: "Download link not found" });
|
| 129 |
}
|
|
@@ -136,9 +130,22 @@ app.get("/api/direct", async (req, res) => {
|
|
| 136 |
redirect: "auto",
|
| 137 |
headers: {
|
| 138 |
"cookie": cookieHeader,
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
}
|
| 143 |
});
|
| 144 |
|
|
|
|
| 115 |
await page.goto(url, { waitUntil: "domcontentloaded", timeout: 60000 });
|
| 116 |
|
| 117 |
// Step 2: Extract the onclick link
|
| 118 |
+
const intermediate = await page.$eval(".wildbutton", el =>
|
| 119 |
+
el.getAttribute("onclick").match(/'(.*?)'/)[1]
|
| 120 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
if (!intermediate) {
|
| 122 |
return res.status(404).json({ status: false, error: "Download link not found" });
|
| 123 |
}
|
|
|
|
| 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 |
|