consumet/consumet.ts

Animepahe episode sources return 404

Closed this issue · 0 comments

Describe the bug

Animepahe provider for getting episode source id is not working

Steps to reproduce

Step 1
Trying to get the episode sources of one piece's last episode, returns incorrect id

 const res = await animepahe.search('One Piece');

  const data1 = await animepahe.fetchAnimeInfo(res.results[0].id);
  const lastEpisodeLenght = data1.episodes?.length;

  const episode = data1.episodes![lastEpisodeLenght! - 1];

  const data = await animepahe.fetchEpisodeSources(data1.episodes![lastEpisodeLenght! - 1].id);

returned id
4

Expected behavior

The returned of particular episode should be in this format
anime_id/episode_id ``e5900435-3228-d9a7-8818-cba931c791e6/f9ffe2ac5b7c17ef2f2bf71491eb553476850ca2f3441f859bf266bb7909c454

Actual behavior

To return the correct episode id.

Additional context

I have already inspected and solved this, and found out that, the bug is from withing the function fetchEpisodes.

 return [
      ...epData.map(
        (item: any): IAnimeEpisode => ({
          id: item.anime_id,
          number: item.episode,
          title: item.title,
          image: item.snapshot,
          duration: item.duration,
          url: `${this.baseUrl}/play/${session}/${item.session}`,
        })
      ),
    ] as IAnimeEpisode[];

The id should should rather be

... id:${session}/${item.session}, ...
Will be creating a PR for this.