Closure-RI commited on
Commit
29fbec5
·
verified ·
1 Parent(s): 41a09b0

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +8 -27
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
- // 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;
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) {