Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
@@ -1282,39 +1282,20 @@ async function scrapeHAnimeDetails(url) {
|
|
1282 |
const newPageHTML = responseB.data;
|
1283 |
console.log("HTML Konten Data-ID:", newPageHTML);
|
1284 |
|
1285 |
-
//
|
1286 |
-
const
|
1287 |
-
|
1288 |
-
let match;
|
1289 |
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
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("
|
1314 |
}
|
1315 |
}
|
1316 |
|
1317 |
|
|
|
1318 |
await browser.close();
|
1319 |
return result;
|
1320 |
} catch (error) {
|
|
|
1282 |
const newPageHTML = responseB.data;
|
1283 |
console.log("HTML Konten Data-ID:", newPageHTML);
|
1284 |
|
1285 |
+
// Ekstrak URL video langsung dari HTML
|
1286 |
+
const videoUrlRegex = /file:\s*"(https?:\/\/[^"]+\.mp4)"/;
|
1287 |
+
const match = newPageHTML.match(videoUrlRegex);
|
|
|
1288 |
|
1289 |
+
if (match && match[1]) {
|
1290 |
+
result.video = match[1];
|
1291 |
+
console.log("Video URL:", result.video);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1292 |
} else {
|
1293 |
+
console.log("Video URL tidak ditemukan dalam HTML!");
|
1294 |
}
|
1295 |
}
|
1296 |
|
1297 |
|
1298 |
+
|
1299 |
await browser.close();
|
1300 |
return result;
|
1301 |
} catch (error) {
|