Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
@@ -1275,25 +1275,45 @@ async function scrapeHAnimeDetails(url) {
|
|
1275 |
: null;
|
1276 |
|
1277 |
if (dataId) {
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1297 |
|
1298 |
await browser.close();
|
1299 |
return result;
|
|
|
1275 |
: null;
|
1276 |
|
1277 |
if (dataId) {
|
1278 |
+
console.log("Data-ID URL:", dataId);
|
1279 |
+
|
1280 |
+
// Ambil konten dari data-id
|
1281 |
+
const responseB = await axios.get(`https://arashicode-api.hf.space/html?url=${dataId}`);
|
1282 |
+
const newPageHTML = responseB.data;
|
1283 |
+
console.log("HTML Konten Data-ID:", newPageHTML);
|
1284 |
+
|
1285 |
+
// Cari script yang mengandung konfigurasi jwplayer.setup
|
1286 |
+
const scriptTagRegex = /<script\b[^>]*>([\s\S]*?)<\/script>/g;
|
1287 |
+
let scriptContent;
|
1288 |
+
let match;
|
1289 |
+
|
1290 |
+
// Iterasi semua <script> tag dalam HTML
|
1291 |
+
while ((match = scriptTagRegex.exec(newPageHTML)) !== null) {
|
1292 |
+
const scriptBody = match[1];
|
1293 |
+
if (scriptBody && scriptBody.includes("jwplayer.setup")) {
|
1294 |
+
scriptContent = scriptBody;
|
1295 |
+
break;
|
1296 |
+
}
|
1297 |
+
}
|
1298 |
+
|
1299 |
+
if (scriptContent) {
|
1300 |
+
console.log("Konten Script JWPlayer:", scriptContent);
|
1301 |
+
|
1302 |
+
// Ekstrak URL video dari script
|
1303 |
+
const videoUrlRegex = /file:\s*"(https?:\/\/[^"]+\.mp4)"/;
|
1304 |
+
const videoMatch = scriptContent.match(videoUrlRegex);
|
1305 |
+
|
1306 |
+
if (videoMatch && videoMatch[1]) {
|
1307 |
+
result.video = videoMatch[1];
|
1308 |
+
console.log("Video URL:", result.video);
|
1309 |
+
} else {
|
1310 |
+
console.log("Video URL tidak ditemukan dalam script!");
|
1311 |
+
}
|
1312 |
+
} else {
|
1313 |
+
console.log("Script JWPlayer tidak ditemukan dalam HTML!");
|
1314 |
+
}
|
1315 |
+
}
|
1316 |
+
|
1317 |
|
1318 |
await browser.close();
|
1319 |
return result;
|