better-ani-scraped 1.6.9 → 1.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,9 +2,9 @@ import { AnimeScraper } from "../../index.js"; // REPLACE BY "from 'better-ani-s
|
|
|
2
2
|
|
|
3
3
|
const main = async () => {
|
|
4
4
|
const animesama = new AnimeScraper('animesama');
|
|
5
|
-
const seasonUrl = "https://anime-sama.fr/catalogue/
|
|
5
|
+
const seasonUrl = "https://anime-sama.fr/catalogue/one-piece/saison11/vostfr";
|
|
6
6
|
|
|
7
|
-
const embeds = await animesama.getEmbed(seasonUrl, ["sibnet", "vidmoly", "sendvid"], true, true);
|
|
7
|
+
const embeds = await animesama.getEmbed(seasonUrl, ["smoothpre", "movearnpre", "sibnet", "vidmoly", "sendvid"], true, true);
|
|
8
8
|
|
|
9
9
|
console.log("Embed Links:", JSON.stringify(embeds, null, 2));
|
|
10
10
|
|
package/package.json
CHANGED
package/scrapers/animesama.js
CHANGED
|
@@ -256,7 +256,7 @@ export async function getEmbed(
|
|
|
256
256
|
.get(scriptUrl, { headers: getHeaders(seasonUrl) })
|
|
257
257
|
.then((r) => r.data);
|
|
258
258
|
|
|
259
|
-
const matches = [...episodesJs.matchAll(/var\s+(eps\d+)\s*=\s*(\[[^\]]+\])/g)];
|
|
259
|
+
const matches = [...episodesJs.toLowerCase().matchAll(/var\s+(eps\d+)\s*=\s*(\[[^\]]+\])/g)];
|
|
260
260
|
if (!matches.length) throw new Error("No episode arrays found");
|
|
261
261
|
|
|
262
262
|
let episodeMatrix = [];
|
|
@@ -279,18 +279,18 @@ export async function getEmbed(
|
|
|
279
279
|
|
|
280
280
|
for (const host of hostPriority) {
|
|
281
281
|
for (const arr of episodeMatrix) {
|
|
282
|
-
if (i < arr.length && arr[i].includes(host)) {
|
|
283
|
-
if (!hosts.includes(host)) {
|
|
282
|
+
if (i < arr.length && arr[i].includes(host.toLowerCase())) {
|
|
283
|
+
if (!hosts.includes(host.toLowerCase())) {
|
|
284
284
|
urls.push(arr[i]);
|
|
285
|
-
hosts.push(host);
|
|
285
|
+
hosts.push(host.toLowerCase());
|
|
286
286
|
}
|
|
287
|
-
break;
|
|
287
|
+
break;
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
finalEmbeds.push({
|
|
293
|
-
title: null,
|
|
293
|
+
title: null,
|
|
294
294
|
url: urls.length ? urls : null,
|
|
295
295
|
host: hosts.length ? hosts : null,
|
|
296
296
|
});
|
|
@@ -301,9 +301,9 @@ export async function getEmbed(
|
|
|
301
301
|
|
|
302
302
|
for (const host of hostPriority) {
|
|
303
303
|
for (const arr of episodeMatrix) {
|
|
304
|
-
if (i < arr.length && arr[i].includes(host)) {
|
|
304
|
+
if (i < arr.length && arr[i].includes(host.toLowerCase())) {
|
|
305
305
|
selectedUrl = arr[i];
|
|
306
|
-
selectedHost = host;
|
|
306
|
+
selectedHost = host.toLowerCase();
|
|
307
307
|
break;
|
|
308
308
|
}
|
|
309
309
|
}
|
|
@@ -311,7 +311,7 @@ export async function getEmbed(
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
finalEmbeds.push({
|
|
314
|
-
title: null,
|
|
314
|
+
title: null,
|
|
315
315
|
url: selectedUrl || null,
|
|
316
316
|
host: selectedHost || null,
|
|
317
317
|
});
|