nattadasu / animeApi

A RESTful API for anime relation mapping and auto redirect service across multiple anime databases
https://animeapi.my.id
GNU Affero General Public License v3.0
27 stars 6 forks source link

Redirecting with /platform.json may return 404 and Kaize ID is not int after remap #2

Closed KirkSuD closed 9 months ago

KirkSuD commented 9 months ago

Hi, amazing project! This aggregates so much data from so many sources!

I got 404 when calling api.get_list_index(), api.get_dict_anime_relations(), api.get_list_anime_relations(). I found there's an extra .json in the requested url in animeapi.py get_dict_anime_relations() & get_list_anime_relations().

Then I got WrongTypeError: wrong value type for field "kaize_id" - should be "typing.Union[int, NoneType]" instead of value "5-fun-de-wakaru-tate-no-yuusha-no-nariagari" of type "str". The problem is kaize_id is sometimes str, so it doesn't match class AnimeRelation: kaize_id: Optional[int] = None in models.py. I temporarily changed my local copy of it to kaize_id: Optional[Union[int, str]] = None, but I'm not sure if this is correct? I didn't find the API docs of kaize.io. Can kaize_id sometimes be str? It's probably related to animeApi/generator/kaize.py & animeApi/generator/converter.py.

Thank you for this amazing project.

nattadasu commented 9 months ago

Heya! Thanks for reporting the issue.

For 2nd error, can you provide what you're doing, which func, and provider you're looking for? This will help me looking up wth happened with the parser easily.

KirkSuD commented 9 months ago

I got the 2nd error when I call one of these: api.get_list_index(), api.get_dict_anime_relations(animeapi.Platform.MYANIMELIST), api.get_list_anime_relations(animeapi.Platform.MYANIMELIST). They would call the converter, then use the AnimeRelation dataclass.

nattadasu commented 9 months ago

Alright, it seems the manual override has some dumb logic during fixing the entry (manual db: https://github.com/nattadasu/animeApi/blob/v3/database/raw/kaize_manual.json, code: https://github.com/nattadasu/animeApi/blob/d127e02268d04939cdcae145adbc9d09019f5f2f/generator/converter.py).... especially on this range https://github.com/nattadasu/animeApi/blob/d127e02268d04939cdcae145adbc9d09019f5f2f/generator/converter.py#L124-L127

whoops.

As I said earlier, I'll fix those known issue when I have time :D

So far the issues are found, and most of them on AnimeAPI main repo:

To make this easier to me to look up, I'll transfer this issue to main repo instead.