jonathanlo411 / malConnect

Watch/Read easily directly from MyAnimeList
GNU General Public License v3.0
3 stars 0 forks source link

Shikimori throws an error #14

Closed jonathanlo411 closed 1 year ago

jonathanlo411 commented 1 year ago

Trace

build.js:8 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'id')

Seems like HTTPs request failed?

jonathanlo411 commented 1 year ago

Shikimori

jonathanlo411 commented 1 year ago

Diagnosis

This issue is not related to #5. Rather, it seems MangaDex API sometimes returns blanks. After some light testing, it occurs under 2 (known) situations.

  1. The title on MangaDex is in English while on MAL it is in Romanji
  2. The title is really long thus being prone to worse search. This may be common with LN titles. One known example is this.

API response returns no data and looks like:

{"result":"ok","response":"collection","data":[],"limit":10,"offset":0,"total":0}

Solution:

There is no clean solution but if the API returns no data, will make another request with the Japanese title (w/ kanji). This solution should be best because MangaDex keeps track of the Japanese titles and English titles are not always available on MAL.