Spaces:
Sleeping
Sleeping
Closure-RI
commited on
Update index.js
Browse files
index.js
CHANGED
@@ -989,73 +989,43 @@ app.post("/cobalt", async (req, res) => {
|
|
989 |
*********************/
|
990 |
|
991 |
|
992 |
-
|
993 |
-
|
994 |
-
async function spankbang_search(keyword) {
|
995 |
-
const browser = await puppeteer.launch({
|
996 |
headless: true,
|
997 |
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
998 |
});
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
metadata: {
|
1023 |
-
hd: element.querySelector("a > span.video-badge.h")?.innerText.trim() || "Un HD",
|
1024 |
-
duration: element.querySelector("a > span.video-badge.l")?.innerText.trim() || "0m",
|
1025 |
-
views: element.querySelector("div > div.uploader-and-stats-wrapper > div > span.v")?.innerText.trim() || "0",
|
1026 |
-
likesPercentage: element.querySelector("div > div.uploader-and-stats-wrapper > div > span.r")?.innerText.trim() || "0%",
|
1027 |
-
date: element.querySelector("div > div.uploader-and-stats-wrapper > div > span.d")?.innerText.trim() || "0 years"
|
1028 |
-
},
|
1029 |
-
link: element.querySelector("a")?.href || "N/A",
|
1030 |
-
img: element.querySelector("a > picture > img")?.src || "N/A",
|
1031 |
-
img_data: element.querySelector("a > picture > img")?.getAttribute("data-src") || "N/A",
|
1032 |
-
preview: element.querySelector("a > picture > img")?.getAttribute("data-preview") || "N/A"
|
1033 |
-
});
|
1034 |
-
});
|
1035 |
-
|
1036 |
-
return data;
|
1037 |
-
});
|
1038 |
-
|
1039 |
-
let ht = await page.content();
|
1040 |
-
|
1041 |
-
await browser.close();
|
1042 |
-
return { result: scrapedData, html: ht };
|
1043 |
-
|
1044 |
-
} catch (error) {
|
1045 |
-
console.error("Error during scraping:", error.message);
|
1046 |
-
let hty = await page.content();
|
1047 |
-
await browser.close();
|
1048 |
-
return { result: [], html: hty };
|
1049 |
-
}
|
1050 |
}
|
1051 |
|
1052 |
|
1053 |
// Rute untuk menerima data melalui query string (GET)
|
1054 |
-
app.get('/
|
1055 |
-
const {
|
1056 |
-
if (!
|
1057 |
try {
|
1058 |
-
const base64Result = await
|
1059 |
res.json(base64Result); // Mengirimkan buffer gambar sebagai respons
|
1060 |
} catch (error) {
|
1061 |
res.status(500).send(error);
|
|
|
989 |
*********************/
|
990 |
|
991 |
|
992 |
+
async function iwaraDL(url) {
|
993 |
+
const browser = await puppeteer.launch({
|
|
|
|
|
994 |
headless: true,
|
995 |
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
996 |
});
|
997 |
+
const page = await browser.newPage();
|
998 |
+
await page.setUserAgent("Mozilla/5.0 (Linux; Android 10; SM-G965U Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/114.0.5735.141 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/420.0.0.32.61;]");
|
999 |
+
await page.goto("https://fetchfile.me/download-iwara/", { waitUntil: 'domcontentloaded' });
|
1000 |
+
await page.type('#url', url);
|
1001 |
+
await page.click('#ring');
|
1002 |
+
await page.waitForSelector('#result > div > div.youtube.col-md-7 > ul > li');
|
1003 |
+
|
1004 |
+
const title = await page.$eval('#result > div > div.youtube.col-md-7 > h2', el => el.innerText);
|
1005 |
+
const originalSource = await page.$eval('#mp4 > table > tbody > tr:nth-child(1) > td:nth-child(3) > a.dlw', el => el.href || null);
|
1006 |
+
const high = await page.$eval('#mp4 > table > tbody > tr:nth-child(2) > td:nth-child(3) > a.dlw', el => el.href || null);
|
1007 |
+
const standard = await page.$eval('#mp4 > table > tbody > tr:nth-child(3) > td:nth-child(3) > a.dlw', el => el.href || null);
|
1008 |
+
const low = await page.$eval('#mp4 > table > tbody > tr:nth-child(4) > td:nth-child(3) > a.dlw', el => el.href || null);
|
1009 |
+
|
1010 |
+
let ht = await page.content();
|
1011 |
+
console.log("\n========================\n\n\n " + ht + " \n========================\n")
|
1012 |
+
await browser.close();
|
1013 |
+
return {
|
1014 |
+
title,
|
1015 |
+
originalSource: originalSource || 'Original source not available',
|
1016 |
+
high: high || 'High quality not available',
|
1017 |
+
standard: standard || 'Standard quality not available',
|
1018 |
+
low: low || 'Low quality not available'
|
1019 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1020 |
}
|
1021 |
|
1022 |
|
1023 |
// Rute untuk menerima data melalui query string (GET)
|
1024 |
+
app.get('/iwara/download', async (req, res) => {
|
1025 |
+
const { url } = req.query;
|
1026 |
+
if (!url) return res.status(400).json({ error: 'Parameter url is required' });
|
1027 |
try {
|
1028 |
+
const base64Result = await iwaraDL(url);
|
1029 |
res.json(base64Result); // Mengirimkan buffer gambar sebagai respons
|
1030 |
} catch (error) {
|
1031 |
res.status(500).send(error);
|