From 7c15aacd3021d25af122ac1a95941b3b661969b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9luchu?= Date: Sun, 14 Jun 2020 19:10:27 +0200 Subject: [PATCH] Fixed some animes that didn't load --- src/api/api.js | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index 33bcaf7..f99b42b 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -237,16 +237,41 @@ const getMoreInfo = async (title) =>{ let animeType = '' let animeIndex = '' + let seriesTitle + let position + + const titles = [ + { animeflv: 'Kaguya-sama wa Kokurasetai: Tensai-tachi no Renai Zunousen 2nd Season', myanimelist: 'Kaguya-sama wa Kokurasetai?: Tensai-tachi no Renai Zunousen', alternative: 'Kaguya-sama wa Kokurasetai'}, + { animeflv: 'Naruto Shippuden', myanimelist: 'Naruto: Shippuuden' }, + { animeflv: 'Rock Lee no Seishun Full-Power Ninden', myanimelist: 'Naruto SD: Rock Lee no Seishun Full-Power Ninden' } + ]; + + for (let name in titles) { + if (title === titles[name].animeflv || title === titles[name].myanimelist || title === titles[name].alternative) { + seriesTitle = titles[name].animeflv + position = name + } + } + + if (seriesTitle === undefined) { + seriesTitle = title + } + await getAllAnimes().then(data => { data.forEach(function (anime) { - if (anime.title.split('\t')[0] === title.split('\t')[0] || anime.title === `${title} (TV)`) { + if (anime.title.split('\t')[0] === seriesTitle.split('\t')[0] || anime.title === `${seriesTitle} (TV)`) { if (anime.title.includes('(TV)', 0)) { animeTitle = anime.title.split('\t')[0].replace(' (TV)', '') } else { animeTitle = anime.title.split('\t')[0] } animeId = anime.id animeIndex = anime.index animeType = anime.type.toLowerCase() + + if (position !== undefined) { + seriesTitle = titles[position].myanimelist + } + } - } + } ) }); @@ -262,13 +287,13 @@ const getMoreInfo = async (title) =>{ rating: extra.animeExtraInfo[0].rating || null, genres: extra.genres || null, episodes: extra.listByEps || null, - moreInfo: await animeExtraInfo(title).then(info =>{ + moreInfo: await animeExtraInfo(seriesTitle).then(info =>{ return info || null }), - promo: await getAnimeVideoPromo(title).then(promo =>{ + promo: await getAnimeVideoPromo(seriesTitle).then(promo =>{ return promo || null }), - characters: await getAnimeCharacters(animeTitle).then(characters =>{ + characters: await getAnimeCharacters(seriesTitle).then(characters =>{ return characters || null }) })));