From 4a0846b02bb95f93fa5d0583f5ebdc9c0a2b54f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cale=C3=ADdoscopio?= Date: Sun, 7 Feb 2021 19:06:47 +0000 Subject: [PATCH] Solving a issue with some animes with the (TV) in their names --- src/api/api.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index a106021..afb329a 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -221,8 +221,14 @@ const getSpecials = async (data) =>{ const getMoreInfo = async (title) =>{ try { let data = directoryAnimes; - let result = data.filter(anime => fuzzball.ratio(anime.title, title) > 90)[0]; - + const result = data.filter(x => { + if (x.title === title) { + return x; + }else { + return x.title === `${title} (TV)` ? x : undefined; + } + })[0]; + if (!result.jkanime) { return { title: result.title || null, @@ -260,7 +266,13 @@ const getMoreInfo = async (title) =>{ const getEpisodes = async (title) =>{ try { let data = directoryAnimes; - const result = data.filter(x => x.title === title)[0]; + const result = data.filter(x => { + if (x.title === title) { + return x; + }else { + return x.title === `${title} (TV)` ? x : undefined; + } + })[0]; if (!result.jkanime) { return await animeflvInfo(result.id).then(episodes => episodes || null);