Skip to content

Commit

Permalink
fix some ids not working
Browse files Browse the repository at this point in the history
  • Loading branch information
riimuru committed Oct 13, 2022
1 parent a5dfefc commit 8f1f474
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ You can contact the maintainers of consumet.ts via [email](mailto:consumet.org@g
## Contributors ✨
Thanks to the following people for keeping this project alive and thriving.

[![](https://avatars.githubusercontent.com/u/57333995?s=50)](https://github.com/riimuru) [![](https://avatars.githubusercontent.com/u/80477926?s=50)](https://github.com/prince-ao) [![](https://avatars.githubusercontent.com/u/98132263?s=50)](https://github.com/JLdev0) [![](https://avatars.githubusercontent.com/u/48152635?s=50)](https://github.com/notSagyo) [![](https://avatars.githubusercontent.com/u/23521035?s=50)](https://github.com/vanelk) [![](https://avatars.githubusercontent.com/u/53954981?s=50)](https://github.com/aidanjuma) [![](https://avatars.githubusercontent.com/u/33759526?s=50)](https://github.com/5H4D0WILA) [![](https://avatars.githubusercontent.com/u/85594230?s=50)](https://github.com/LuckyYam) [![](https://avatars.githubusercontent.com/u/20222292?s=50)](https://github.com/NADESHIKON)
[![](https://avatars.githubusercontent.com/u/57333995?s=50)](https://github.com/riimuru) [![](https://avatars.githubusercontent.com/u/80477926?s=50)](https://github.com/prince-ao) [![](https://avatars.githubusercontent.com/u/98132263?s=50)](https://github.com/JLdev0) [![](https://avatars.githubusercontent.com/u/48152635?s=50)](https://github.com/notSagyo) [![](https://avatars.githubusercontent.com/u/23521035?s=50)](https://github.com/vanelk) [![](https://avatars.githubusercontent.com/u/53954981?s=50)](https://github.com/aidanjuma) [![](https://avatars.githubusercontent.com/u/33759526?s=50)](https://github.com/5H4D0WILA) [![](https://avatars.githubusercontent.com/u/85594230?s=50)](https://github.com/LuckyYam) [![](https://avatars.githubusercontent.com/u/20222292?s=50)](https://github.com/NADESHIKON) [![](https://avatars.githubusercontent.com/u/16653389?s=50)](https://github.com/ErrorErrorError)

### Credits
- [Enime API](https://github.com/Enime-Project/api.enime.moe) - Used as a caching layer for the meta/anilist provider to speed up responses.
Expand Down
4 changes: 2 additions & 2 deletions dist/providers/anime/enime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/providers/anime/enime.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/providers/anime/gogoanime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/providers/anime/gogoanime.js.map

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions dist/providers/meta/anilist.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/providers/meta/anilist.js.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/providers/anime/enime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ class Enime extends AnimeParser {
id: id,
title: '',
};

const { data } = await axios.get(`${this.enimeApi}/mapping/anilist/${id}`).catch(() => {
throw new Error('Anime not found');
const { data } = await axios.get(`${this.enimeApi}/mapping/anilist/${id}`).catch(err => {
throw new Error(err);
});

animeInfo.anilistId = data.anilistId;
Expand Down
6 changes: 2 additions & 4 deletions src/providers/anime/gogoanime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { GogoCDN, StreamSB, USER_AGENT } from '../../utils';

class Gogoanime extends AnimeParser {
override readonly name = 'Gogoanime';
protected override baseUrl = 'https://www1.gogoanime.ee';
protected override baseUrl = 'https://www.gogoanime.dk';
protected override logo =
'https://i0.wp.com/cloudfuji.com/wp-content/uploads/2021/12/gogoanime.png?fit=300%2C400&ssl=1';
protected override classPath = 'ANIME.Gogoanime';
Expand Down Expand Up @@ -59,8 +59,6 @@ class Gogoanime extends AnimeParser {
});
});



return searchResult;
} catch (err) {
throw new Error((err as Error).message);
Expand Down Expand Up @@ -322,4 +320,4 @@ class Gogoanime extends AnimeParser {
};
}

export default Gogoanime;
export default Gogoanime;
17 changes: 11 additions & 6 deletions src/providers/meta/anilist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ class Anilist extends AnimeParser {
item.node.coverImage.medium,
rating: item.node.meanScore,
}));

if (
(this.provider instanceof Zoro || this.provider instanceof Gogoanime) &&
!dub &&
Expand Down Expand Up @@ -621,9 +620,14 @@ class Anilist extends AnimeParser {
(dub ? s.title.toLowerCase().includes('dub') : !s.title.toLowerCase().includes('dub'))
);

if (possibleSource)
possibleAnime = await this.provider.fetchAnimeInfo(possibleSource.url.split('/').pop()!);
else possibleAnime = await this.findAnimeRaw(slug);
if (possibleSource) {
try {
possibleAnime = await this.provider.fetchAnimeInfo(possibleSource.url.split('/').pop()!);
} catch (err) {
console.error(err);
possibleAnime = await this.findAnimeRaw(slug);
}
} else possibleAnime = await this.findAnimeRaw(slug);
} else possibleAnime = await this.findAnimeRaw(slug);
} else possibleAnime = await this.findAnimeRaw(slug);

Expand Down Expand Up @@ -1144,6 +1148,7 @@ class Anilist extends AnimeParser {
possibleAnimeEpisodes.reverse();
} catch (err) {
possibleAnimeEpisodes = await this.fetchDefaultEpisodeList(Media, dub, id);

possibleAnimeEpisodes = possibleAnimeEpisodes?.map((episode: IAnimeEpisode) => {
if (!episode.image)
episode.image = Media.coverImage.extraLarge ?? Media.coverImage.large ?? Media.coverImage.medium;
Expand Down Expand Up @@ -1869,9 +1874,9 @@ class Anilist extends AnimeParser {
}

// (async () => {
// const ani = new Anilist(new Enime());
// const ani = new Anilist();
// console.time('fetch');
// const res = await ani.search('naruto');
// const res = await ani.fetchAnimeInfo('14813');
// console.log(res);
// console.timeEnd('fetch');
// })();
Expand Down

0 comments on commit 8f1f474

Please sign in to comment.