Kylart / MalScraper

Scrape everything you can from MyAnimeList.net
MIT License
177 stars 49 forks source link

Idk if it's an issue. But it's bothering me. #55

Closed folliejester closed 3 years ago

folliejester commented 3 years ago

When i use .getinfofromname('Anohana') If returns an irrevelant anime but when i use .getresultsfromsearch('Anohana') It returns exactly what i want in the first item in the array.. it's not only anohana, it's the same with many other animes as well. What do you think about it? Shall we use getresultsfromsearch and then pick it's first name or url and use that value to search using getinfofromname or getinfofromurl?

Soitora commented 3 years ago

What if you do .getInfoFromName('Ano Hi')?

I believe .getInfoFromName doesn't search synonyms (which I think is the correct approach), which is exactly what you're trying to do. The resulting anime for me when I try the Anohana synonym is:

Meiji x Kokosake & anohana Receipt Oubo Campaign

Kylart commented 3 years ago

Alright. This is not a bug and actually intended.

getInfoFromName actually has two arguments (which is not described in the README, I'll fix this). The first one is the term. The second one allows you to chose how the result will be chosen.

By default, the second argument is set to true. So here's what the function will do:

  1. Use getResultsFromSearch
  2. Use match-sorter to find the best result that fits the request.

If you set the second argument to false (e.g.: mal.getInfoFromName('Anohana', false)), the method will return the first element of the search which is what you seem to want and that also is the first answer that you would get from MAL directly.

Hope this helps.