C#C
C#5mo ago
Theos

Optimizing requests MyAnimeList - need help

Hey!
I'm working on an app for watching anime and I need to optimize one feature.

It all starts here, you can have episode files in some folder and my app will try to parse them all to find out what anime, episode and season it is.
It becomes problematic when I try to parse file that doesn't specify season number, then I need to do some magic that happens in here
I basically first extract the anime title and episode, search MAL (MyAnimeList) for that anime here, which is the first request, then I loop thru all related anime (prequels and sequels) here, which adds more requests. I then sum all episodes for each season and now I know that using the absolute episode numbering, the Anime name - Episode 17 is a second season , episode 5 of that anime. I tried implementing cache, some request optimizations etc but it's still slow. For 16 different files it takes around 16 seconds to process them all. If there would be more I will probably rate-limit myself from MAL.
Here are all relevant MAL documentation pages:
https://myanimelist.net/apiconfig/references/api/v2#operation/users_user_id_animelist_get
https://myanimelist.net/apiconfig/references/api/v2#operation/anime_get

Any ideas how to solve this issue?
Was this page helpful?