better-ani-scraped 1.3.1 → 1.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-ani-scraped",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Scrape anime data from different sources (only anime-sama.fr for the moment)",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -131,11 +131,12 @@ import { promisify } from 'util';
131
131
  const execAsync = promisify(execCallback);
132
132
 
133
133
  async function ensureChromiumInstalled(customPath) {
134
- if (customPath && customPath.includes('chrome')) {
134
+ if (customPath) {
135
135
  if (fs.existsSync(customPath)) {
136
+ console.log("customPath:", customPath);
136
137
  return customPath;
137
138
  } else {
138
- throw new Error(`The custom path to Chromium is invalid : ${customPath}`);
139
+ console.log(`The custom path to Chromium is invalid : ${customPath}`);
139
140
  }
140
141
  }
141
142
  const basePath = path.join(
@@ -195,7 +196,7 @@ export async function getEpisodeTitles(animeUrl, customChromiumPath) {
195
196
  }
196
197
 
197
198
 
198
- export async function getEmbed(animeUrl, hostPriority = ["vidmoly"]) {
199
+ export async function getEmbed(animeUrl, hostPriority = ["vidmoly"], customChromiumPath) {
199
200
  const res = await axios.get(animeUrl, {
200
201
  headers: getHeaders(animeUrl.split("/").slice(0, 5).join("/")),
201
202
  });
@@ -243,7 +244,7 @@ export async function getEmbed(animeUrl, hostPriority = ["vidmoly"]) {
243
244
  finalEmbeds.push(selectedUrl || null);
244
245
  }
245
246
 
246
- const titles = await getEpisodeTitles(animeUrl);
247
+ const titles = await getEpisodeTitles(animeUrl, customChromiumPath);
247
248
  return finalEmbeds.map((url, i) => ({
248
249
  title: titles[i] || "Untitled",
249
250
  url,
@@ -84,9 +84,9 @@ export class AnimeScraper {
84
84
  }
85
85
  }
86
86
 
87
- async getEpisodeTitles(animeUrl) {
87
+ async getEpisodeTitles(animeUrl, ...rest) {
88
88
  try {
89
- return await this.source.getEpisodeTitles(animeUrl);
89
+ return await this.source.getEpisodeTitles(animeUrl, ...rest);
90
90
  } catch (error) {
91
91
  console.error(`This scraper does not have the getRandomAnime function implemented or an error happened -> ${error}`);
92
92
  return null;