animec
animec copied to clipboard
fix fetching genre of a single-genre anime + UnicodeEncodeError
The module failed to fetch genres for an anime with only a single genre listed on MAL, like Lycoris Recoil.
This was because the singular noun "Genre" was used instead of "Genres".
The addition of an or condition fixed it.
Thanks for your fantastic work.
For anime like Saiki Kusuo no Ψ-nan
, the myanimelist URL contained non-ASCII characters in the request path which raised a UnicodeEncodeError
when using urllib.request.urlopen
.
The solution was to quote the path part of requests to percent-escape those non-ASCII characters.
Example: https://myanimelist.net/anime/33255/Saiki_Kusuo_no_Ψ-nan
to https://myanimelist.net/anime/33255/Saiki_Kusuo_no_%CE%A8-nan
Although this solution works for now, I'd suggest using the requests library which supports this out-of-the-box.