better-ani-scraped 1.6.0 → 1.6.1
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.
- package/DOCUMENTATION.md +3 -2
- package/package.json +1 -1
- package/scrapers/animesama.js +26 -16
package/DOCUMENTATION.md
CHANGED
|
@@ -30,7 +30,7 @@ const crunchyroll = new AnimeScraper('crunchyroll') //for Crunchyroll
|
|
|
30
30
|
- [searchAnime](#animesamasearchanimequery-limit--10-wantedlanguages--vostfr-vf-vastfr-wantedtypes--anime-film-page--null)
|
|
31
31
|
- [getSeasons](#animesamagetseasonsanimeurl-language--vostfr)
|
|
32
32
|
- [getEpisodeTitles](#animesamagetepisodetitlesseasonurl-customchromiumpath)
|
|
33
|
-
- [getEmbed](#animesamagetembedseasonurl-hostpriority--sibnet-vidmoly)
|
|
33
|
+
- [getEmbed](#animesamagetembedseasonurl-hostpriority--sendvid-sibnet-vidmoly-oneupload)
|
|
34
34
|
- [getAnimeInfo](#animesamagetanimeinfoanimeurl)
|
|
35
35
|
- [getAvailableLanguages](#animesamagetavailablelanguagesseasonurl-wantedlanguages--vostfr-vf-va-vkr-vcn-vqc-vf1-vf2-numberepisodes--false)
|
|
36
36
|
- [getAllAnime](#animesamagetallanimewantedlanguages--vostfr-vf-vastfr-wantedtypes--anime-film-page--null-output--anime_listjson-get_seasons--false)
|
|
@@ -95,7 +95,7 @@ Fetches the names of all episodes in a season
|
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
-
### `animesama.getEmbed(seasonUrl, hostPriority = ["sibnet", "vidmoly"])`
|
|
98
|
+
### `animesama.getEmbed(seasonUrl, hostPriority = ["sendvid", "sibnet", "vidmoly", "oneupload"])`
|
|
99
99
|
Retrieves embed URLs for episodes, prioritizing by host.
|
|
100
100
|
|
|
101
101
|
- **Parameters:**
|
|
@@ -108,6 +108,7 @@ Retrieves embed URLs for episodes, prioritizing by host.
|
|
|
108
108
|
{
|
|
109
109
|
title: string,
|
|
110
110
|
url: string,
|
|
111
|
+
host: string,
|
|
111
112
|
}
|
|
112
113
|
...
|
|
113
114
|
]
|
package/package.json
CHANGED
package/scrapers/animesama.js
CHANGED
|
@@ -215,7 +215,7 @@ export async function getEpisodeTitles(seasonUrl, customChromiumPath) {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
export async function getEmbed(seasonUrl, hostPriority = ["sibnet", "vidmoly"], customChromiumPath) {
|
|
218
|
+
export async function getEmbed(seasonUrl, hostPriority = ["sendvid", "sibnet", "vidmoly", "oneupload"], customChromiumPath) {
|
|
219
219
|
const res = await axios.get(seasonUrl, {
|
|
220
220
|
headers: getHeaders(seasonUrl.split("/").slice(0, 5).join("/")),
|
|
221
221
|
});
|
|
@@ -249,25 +249,35 @@ export async function getEmbed(seasonUrl, hostPriority = ["sibnet", "vidmoly"],
|
|
|
249
249
|
|
|
250
250
|
const maxEpisodes = Math.max(...episodeMatrix.map(arr => arr.length));
|
|
251
251
|
const finalEmbeds = [];
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
252
|
+
for (let i = 0; i < maxEpisodes; i++) {
|
|
253
|
+
let selectedUrl = null;
|
|
254
|
+
let selectedHost = null;
|
|
255
|
+
|
|
256
|
+
for (const host of hostPriority) {
|
|
257
|
+
for (const arr of episodeMatrix) {
|
|
258
|
+
if (i < arr.length && arr[i].includes(host)) {
|
|
259
|
+
selectedUrl = arr[i];
|
|
260
|
+
selectedHost = host;
|
|
261
|
+
break;
|
|
260
262
|
}
|
|
261
|
-
if (selectedUrl) break;
|
|
262
263
|
}
|
|
263
|
-
|
|
264
|
+
if (selectedUrl) break;
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
finalEmbeds.push({
|
|
268
|
+
url: selectedUrl || null,
|
|
269
|
+
host: selectedHost || null
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const titles = await getEpisodeTitles(seasonUrl, customChromiumPath);
|
|
274
|
+
|
|
275
|
+
return finalEmbeds.map((embed, i) => ({
|
|
276
|
+
title: titles[i] || null,
|
|
277
|
+
url: embed.url,
|
|
278
|
+
host: embed.host
|
|
279
|
+
}));
|
|
280
|
+
|
|
271
281
|
}
|
|
272
282
|
|
|
273
283
|
export async function getAnimeInfo(animeUrl) {
|