From 1783b49c2263278835f004d228ab48405b989b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cale=C3=ADdoscopio?= Date: Sun, 7 Feb 2021 18:18:28 +0000 Subject: [PATCH 1/9] Fixing the title of black clover, to get exact information --- src/assets/directory.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/directory.json b/src/assets/directory.json index 10aaa27..f001369 100644 --- a/src/assets/directory.json +++ b/src/assets/directory.json @@ -46795,7 +46795,7 @@ }, { "id": "black-clover-tv", - "title": "Black Clover (TV)", + "title": "Black Clover", "mal_id": 34572, "poster": "https://aruppi.jeluchu.xyz/res/directory/2746.jpg", "type": "Anime", From 992d35799b423b41e859bef631e4987868a9a18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cale=C3=ADdoscopio?= Date: Sun, 7 Feb 2021 18:54:09 +0000 Subject: [PATCH 2/9] Going back to the same directory --- src/assets/directory.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/directory.json b/src/assets/directory.json index f001369..10aaa27 100644 --- a/src/assets/directory.json +++ b/src/assets/directory.json @@ -46795,7 +46795,7 @@ }, { "id": "black-clover-tv", - "title": "Black Clover", + "title": "Black Clover (TV)", "mal_id": 34572, "poster": "https://aruppi.jeluchu.xyz/res/directory/2746.jpg", "type": "Anime", 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 3/9] 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); From 56d063bf9b3dd5112be42bb31f50a335ed0aa3db Mon Sep 17 00:00:00 2001 From: capitanwesler Date: Mon, 8 Feb 2021 14:18:29 +0000 Subject: [PATCH 4/9] Fixing issues with the .json data and deleting some unused variables --- src/api/api.js | 41 +++++++++++++++++++++++------------------ src/api/routes/index.js | 2 +- src/utils/index.js | 9 +++------ 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index afb329a..e1a4f69 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -74,20 +74,29 @@ const getAllAnimes = async () =>{ }; const getAllDirectory = async (genres) => { - let data; - if (genres === 'sfw') { - data = directoryAnimes.filter(function (item) { - return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi"); + return directoryAnimes.filter(function (doc) { + if (doc.genres.indexOf('Ecchi') === -1 && doc.genres.indexOf('ecchi') === -1) { + return { + id: doc.id, + title: doc.title, + mal_id: doc.mal_id, + poster: doc.poster, + type: doc.type, + genres: doc.genres, + state: doc.state, + score: doc.score, + jkanime: false, + description: doc.description + }; + } }); - } else { - data = directoryAnimes; } - return data.map(doc => ({ + return directoryAnimes.map(doc => ({ id: doc.id, title: doc.title, - mal_title: doc.mal_title, + mal_id: doc.mal_id, poster: doc.poster, type: doc.type, genres: doc.genres, @@ -107,7 +116,7 @@ const getAnitakume = async () => { const body = JSON.parse(JSON.stringify(rss, null, 3)).items body.map(doc =>{ - let time = new Date(doc.created) + let time = new Date(doc.created); const monthNames = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]; let day = time.getDate() @@ -220,8 +229,7 @@ const getSpecials = async (data) =>{ const getMoreInfo = async (title) =>{ try { - let data = directoryAnimes; - const result = data.filter(x => { + const result = directoryAnimes.filter(x => { if (x.title === title) { return x; }else { @@ -265,8 +273,7 @@ const getMoreInfo = async (title) =>{ const getEpisodes = async (title) =>{ try { - let data = directoryAnimes; - const result = data.filter(x => { + const result = directoryAnimes.filter(x => { if (x.title === title) { return x; }else { @@ -376,7 +383,7 @@ const getThemesYear = async (year) => { const getRandomTheme = async () => { let data = await homgot(`${BASE_THEMEMOE}roulette`, { parse: true }); - let themes = await getThemes(data.themes) + let themes = await getThemes(data.themes); return themes.map(doc =>({ name: data.name, @@ -514,10 +521,8 @@ const getProfilePlatform = async (id) => { }; async function getRandomAnime() { - let data = directoryAnimes; - - const randomNumber = Math.floor(Math.random() * data.length); - let result = data[randomNumber]; + const randomNumber = Math.floor(Math.random() * directoryAnimes.length); + let result = directoryAnimes[randomNumber]; if (!result.jkanime) { return { diff --git a/src/api/routes/index.js b/src/api/routes/index.js index d661930..11ac753 100644 --- a/src/api/routes/index.js +++ b/src/api/routes/index.js @@ -60,8 +60,8 @@ router.get('/allAnimes' , (req, res) =>{ }); router.get('/allDirectory/:genres?' , (req, res) =>{ - let genres = req.params.genres; + api.getAllDirectory(genres) .then(directory =>{ if (directory.length > 0) { diff --git a/src/utils/index.js b/src/utils/index.js index 3ffe51e..1cbe989 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -140,10 +140,8 @@ const jkanimeInfo = async (id) => { }; function getPosterAndType(id, mal_id) { - let data = directoryAnimes; - if (id) { - for (let anime of data) { + for (let anime of directoryAnimes) { if (anime.id === id) { return [ anime.poster, @@ -154,7 +152,7 @@ function getPosterAndType(id, mal_id) { } if (mal_id) { - for (let anime of data) { + for (let anime of directoryAnimes) { if (anime.mal_id === parseInt(mal_id)) { return [ anime.poster, @@ -401,9 +399,8 @@ const imageUrlToBase64 = async (url) => { }; const searchAnime = async (query) => { - let data = directoryAnimes; let queryLowerCase = query.toLowerCase(); - const res = data.filter(x => x.title.toLowerCase().includes(queryLowerCase)); + const res = directoryAnimes.filter(x => x.title.toLowerCase().includes(queryLowerCase)); return res.map(doc => ({ id: doc.id || null, From 01d23d5076106540bd6050e0553cdb0bf06f9602 Mon Sep 17 00:00:00 2001 From: capitanwesler Date: Mon, 8 Feb 2021 21:37:06 +0000 Subject: [PATCH 5/9] Adding again the .includes in the allDirectory --- src/api/api.js | 174 ++++++++++++++++++++++++------------------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index e1a4f69..b131401 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -30,17 +30,17 @@ const { BASE_ANIMEFLV_JELU, BASE_JIKAN, BASE_IVOOX, BASE_QWANT, BASE_YOUTUBE, BASE_THEMEMOE, BASE_ANIMEFLV, BASE_ARUPPI } = require('./urls'); -const schedule = async (day) =>{ +const schedule = async (day) => { const data = await homgot(`${BASE_JIKAN}schedule/${day.current}`, { parse: true }); - return data[day.current].map(doc =>({ - title: doc.title, - malid: doc.mal_id, - image: doc.image_url + return data[day.current].map(doc => ({ + title: doc.title, + malid: doc.mal_id, + image: doc.image_url })); }; -const top = async (top) =>{ +const top = async (top) => { let data; if (top.subtype !== undefined) { @@ -49,7 +49,7 @@ const top = async (top) =>{ data = await homgot(`${BASE_JIKAN}top/${top.type}/${top.page}`, { parse: true }); } - return data.top.map(doc =>({ + return data.top.map(doc => ({ rank: doc.rank, title: doc.title, url: doc.url, @@ -61,7 +61,7 @@ const top = async (top) =>{ })); }; -const getAllAnimes = async () =>{ +const getAllAnimes = async () => { let data = await homgot(`${BASE_ANIMEFLV}api/animes/list`, { parse: true }) return data.map(item => ({ @@ -76,7 +76,7 @@ const getAllAnimes = async () =>{ const getAllDirectory = async (genres) => { if (genres === 'sfw') { return directoryAnimes.filter(function (doc) { - if (doc.genres.indexOf('Ecchi') === -1 && doc.genres.indexOf('ecchi') === -1) { + if (!doc.genres.includes('Ecchi') && !doc.genres.includes('ecchi')) { return { id: doc.id, title: doc.title, @@ -114,7 +114,7 @@ const getAnitakume = async () => { await rss.load(BASE_IVOOX).then(rss => { const body = JSON.parse(JSON.stringify(rss, null, 3)).items - body.map(doc =>{ + body.map(doc => { let time = new Date(doc.created); const monthNames = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]; @@ -124,9 +124,9 @@ const getAnitakume = async () => { let year = time.getFullYear() let date - if(month < 10){ + if (month < 10) { date = `${day} de 0${month} de ${year}` - }else{ + } else { date = `${day} de ${month} de ${year}` } @@ -144,10 +144,10 @@ const getAnitakume = async () => { }; -const getNews = async (pageRss) =>{ +const getNews = async (pageRss) => { let promises = []; - for(let i = 0; i <= pageRss.length -1; i++) { + for (let i = 0; i <= pageRss.length - 1; i++) { await rss.load(pageRss[i].url).then(rss => { const body = JSON.parse(JSON.stringify(rss, null, 3)).items @@ -167,36 +167,36 @@ const getNews = async (pageRss) =>{ return promises; }; -const season = async (season) =>{ +const season = async (season) => { const data = await homgot(`${BASE_JIKAN}season/${season.year}/${season.type}`, { parse: true }); - return data.anime.map(doc =>({ + return data.anime.map(doc => ({ title: doc.title, image: doc.image_url, genres: doc.genres.map(x => x.name) })); }; -const allSeasons = async () =>{ +const allSeasons = async () => { const data = await homgot(`${BASE_JIKAN}season/archive`, { parse: true }); - return data.archive.map(doc =>({ - year: doc.year, - seasons: doc.seasons, + return data.archive.map(doc => ({ + year: doc.year, + seasons: doc.seasons, })); }; -const laterSeasons = async () =>{ +const laterSeasons = async () => { const data = await homgot(`${BASE_JIKAN}season/later`, { parse: true }); - return data.anime.map(doc =>({ - title: doc.title, - image: doc.image_url, - malink: doc.url + return data.anime.map(doc => ({ + title: doc.title, + image: doc.image_url, + malink: doc.url })); }; -const getLastEpisodes = async () =>{ +const getLastEpisodes = async () => { const data = await homgot(`${BASE_ANIMEFLV_JELU}LatestEpisodesAdded`, { parse: true }); return await Promise.all(data.episodes.map(async (item) => ({ @@ -208,35 +208,35 @@ const getLastEpisodes = async () =>{ }))); }; -const getSpecials = async (data) =>{ +const getSpecials = async (data) => { const res = await homgot(`${BASE_ANIMEFLV_JELU}${data.url}/${data.type}/${data.page}`, { parse: true }); - return res[data.prop].map(doc =>({ - id: doc.id, - title: doc.title, - type: data.url.toLowerCase(), - page: data.page, - banner: doc.banner, - image: doc.poster, - synopsis: doc.synopsis, - status: doc.debut, - rate: doc.rating, - genres: doc.genres.map(x => x), - episodes: doc.episodes.map(x => x) + return res[data.prop].map(doc => ({ + id: doc.id, + title: doc.title, + type: data.url.toLowerCase(), + page: data.page, + banner: doc.banner, + image: doc.poster, + synopsis: doc.synopsis, + status: doc.debut, + rate: doc.rating, + genres: doc.genres.map(x => x), + episodes: doc.episodes.map(x => x) })); }; -const getMoreInfo = async (title) =>{ +const getMoreInfo = async (title) => { try { const result = directoryAnimes.filter(x => { if (x.title === title) { return x; - }else { - return x.title === `${title} (TV)` ? x : undefined; + } else { + return x.title === `${title} (TV)` ? x : undefined; } })[0]; - + if (!result.jkanime) { return { title: result.title || null, @@ -251,7 +251,7 @@ const getMoreInfo = async (title) =>{ characters: await getAnimeCharacters(result.mal_id).then(characters => characters || null), related: await getRelatedAnimesFLV(result.id) }; - }else { + } else { return { title: result.title || null, poster: result.poster || null, @@ -271,13 +271,13 @@ const getMoreInfo = async (title) =>{ } }; -const getEpisodes = async (title) =>{ +const getEpisodes = async (title) => { try { const result = directoryAnimes.filter(x => { if (x.title === title) { return x; - }else { - return x.title === `${title} (TV)` ? x : undefined; + } else { + return x.title === `${title} (TV)` ? x : undefined; } })[0]; @@ -298,17 +298,17 @@ const getAnimeServers = async (id) => { return await videoServersJK(id); } else { const data = await homgot(`${BASE_ANIMEFLV_JELU}GetAnimeServers/${id}`, { parse: true }); - + return await transformUrlServer(data.servers); } }; -const search = async (title) =>{ return await searchAnime(title); }; +const search = async (title) => { return await searchAnime(title); }; const getImages = async (query) => { try { const data = await homgot(`${BASE_QWANT}count=${query.count}&q=${query.title}&t=${query.type}&safesearch=${query.safesearch}&locale=${query.country}&uiv=4`, { parse: true }); - return data.data.result.items.map(doc =>({ + return data.data.result.items.map(doc => ({ type: doc.thumb_type, thumbnail: `https:${doc.thumbnail}`, fullsize: `https:${doc.media_fullsize}` @@ -321,12 +321,12 @@ const getImages = async (query) => { const getYoutubeVideos = async (channelId) => { const data = await homgot(`${BASE_YOUTUBE}${channelId.id}&part=${channelId.part}&order=${channelId.order}&maxResults=${channelId.maxResults}`, { parse: true }); - return data[channelId.prop].map(doc =>({ - title: doc.snippet.title, - videoId: doc.id.videoId, - thumbDefault: doc.snippet.thumbnails.default.url, - thumbMedium: doc.snippet.thumbnails.medium.url, - thumbHigh: doc.snippet.thumbnails.high.url + return data[channelId.prop].map(doc => ({ + title: doc.snippet.title, + videoId: doc.id.videoId, + thumbDefault: doc.snippet.thumbnails.default.url, + thumbMedium: doc.snippet.thumbnails.medium.url, + thumbHigh: doc.snippet.thumbnails.high.url })); }; @@ -334,7 +334,7 @@ const getSectionYoutubeVideos = async (type) => { if (type === 'learn') { let data = await homgot(`${BASE_YOUTUBE}UCCyQwSS6m2mVB0-H2FOFJtw&part=snippet,id&order=date&maxResults=50`, { parse: true }); - return data.items.map(doc =>({ + return data.items.map(doc => ({ title: doc.snippet.title, videoId: doc.id.videoId, thumbDefault: doc.snippet.thumbnails.default.url, @@ -344,18 +344,18 @@ const getSectionYoutubeVideos = async (type) => { } else if (type === 'amv') { let yt1 = await homgot(`${BASE_YOUTUBE}UCkTFkshjAsLMKwhAe1uPC1A&part=snippet,id&order=date&maxResults=25`, { parse: true }); let yt2 = await homgot(`${BASE_YOUTUBE}UC2cpvlLeowpqnR6bQofwNew&part=snippet,id&order=date&maxResults=25`, { parse: true }); - return yt1.items.concat(yt2.items).map(doc =>({ + return yt1.items.concat(yt2.items).map(doc => ({ title: doc.snippet.title, videoId: doc.id.videoId, thumbDefault: doc.snippet.thumbnails.default.url, thumbMedium: doc.snippet.thumbnails.medium.url, thumbHigh: doc.snippet.thumbnails.high.url })); - } else if (type === 'produccer'){ + } else if (type === 'produccer') { let yt1 = await homgot(`${BASE_YOUTUBE}UC-5MT-BUxTzkPTWMediyV0w&part=snippet,id&order=date&maxResults=25`, { parse: true }); let yt2 = await homgot(`${BASE_YOUTUBE}UCwUeTOXP3DD9DIvHttowuSA&part=snippet,id&order=date&maxResults=25`, { parse: true }); let yt3 = await homgot(`${BASE_YOUTUBE}UCA8Vj7nN8bzT3rsukD2ypUg&part=snippet,id&order=date&maxResults=25`, { parse: true }); - return yt1.items.concat(yt2.items.concat(yt3.items)).map(doc =>({ + return yt1.items.concat(yt2.items.concat(yt3.items)).map(doc => ({ title: doc.snippet.title, videoId: doc.id.videoId, thumbDefault: doc.snippet.thumbnails.default.url, @@ -385,7 +385,7 @@ const getRandomTheme = async () => { let data = await homgot(`${BASE_THEMEMOE}roulette`, { parse: true }); let themes = await getThemes(data.themes); - return themes.map(doc =>({ + return themes.map(doc => ({ name: data.name, title: doc.name, link: doc.video @@ -400,18 +400,18 @@ const getArtist = async (id) => { } }; -const getAnimeGenres = async(genres) => { +const getAnimeGenres = async (genres) => { let res; let promises = []; - if (genres.genre === undefined && genres.page === undefined && genres.order === undefined) { + if (genres.genre === undefined && genres.page === undefined && genres.order === undefined) { return animeGenres; } else { if (genres.page !== undefined) { - res = await homgot(`${BASE_ANIMEFLV_JELU}Genres/${genres.genre}/${genres.order}/${genres.page}`,{ parse: true }) + res = await homgot(`${BASE_ANIMEFLV_JELU}Genres/${genres.genre}/${genres.order}/${genres.page}`, { parse: true }) } else { - res = await homgot(`${BASE_ANIMEFLV_JELU}Genres/${genres.genre}/${genres.order}/1`,{ parse: true }) + res = await homgot(`${BASE_ANIMEFLV_JELU}Genres/${genres.genre}/${genres.order}/1`, { parse: true }) } let data = res.animes @@ -440,7 +440,7 @@ const getAllThemes = async () => animeThemes; const getDestAnimePlatforms = async () => { let data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/top.json`, { parse: true }); - return data.map(doc =>({ + return data.map(doc => ({ id: doc.id, name: doc.name, logo: doc.logo @@ -454,7 +454,7 @@ const getPlatforms = async (id) => { data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/typeplatforms.json`, { parse: true }); - return data.map(doc =>({ + return data.map(doc => ({ id: doc.id, name: doc.name, comming: doc.comming || false, @@ -463,28 +463,28 @@ const getPlatforms = async (id) => { } if (id === "producers" || id === "apps" || id === "publishers") { - data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/type/${id}.json`, { parse: true }); - - return data.map(doc =>({ - id: doc.id, - name: doc.name, - logo: doc.logo, - cover: doc.cover, - description: doc.description, - type: doc.type, - moreInfo: doc.moreInfo, - facebook: doc.facebook, - twitter: doc.twitter, - instagram: doc.instagram, - webInfo: doc.webInfo, - webpage: doc.webpage - })); + data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/type/${id}.json`, { parse: true }); + + return data.map(doc => ({ + id: doc.id, + name: doc.name, + logo: doc.logo, + cover: doc.cover, + description: doc.description, + type: doc.type, + moreInfo: doc.moreInfo, + facebook: doc.facebook, + twitter: doc.twitter, + instagram: doc.instagram, + webInfo: doc.webInfo, + webpage: doc.webpage + })); } else { data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/type/${id}.json`, { parse: true }); - return data.map(doc =>({ + return data.map(doc => ({ id: doc.id, name: doc.name, type: doc.type, @@ -498,10 +498,10 @@ const getPlatforms = async (id) => { const getProfilePlatform = async (id) => { let data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/platforms/${id}.json`, { parse: true }); - let channelId = { id: data[0].youtubeId, part: 'snippet,id', order: 'date', maxResults: '50', prop: 'items' }; + let channelId = { id: data[0].youtubeId, part: 'snippet,id', order: 'date', maxResults: '50', prop: 'items' }; let videos = await getYoutubeVideos(channelId) - return data.map(doc =>({ + return data.map(doc => ({ id: doc.id, name: doc.name, logo: doc.logo, @@ -538,7 +538,7 @@ async function getRandomAnime() { characters: await getAnimeCharacters(result.mal_id).then(characters => characters || null), related: await getRelatedAnimesFLV(result.id) }; - }else { + } else { return { title: result.title || null, poster: result.poster || null, From ba24488e725caaf175954a748aed306ba08f43a0 Mon Sep 17 00:00:00 2001 From: capitanwesler Date: Mon, 8 Feb 2021 22:10:58 +0000 Subject: [PATCH 6/9] Fixing the error with the automatic merge from develop to this branch --- src/api/api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index 6540ea8..8e8d226 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -1,5 +1,5 @@ const rss = require('rss-to-json'); -const fuzzball = require('fuzzball'); + const { homgot } = require('../api/apiCall'); @@ -463,7 +463,7 @@ const getPlatforms = async (id) => { })); } if (id === "producers" || id === "apps" || id === "publishers" || "events") { - + data = await homgot(`${BASE_ARUPPI}res/documents/animelegal/type/${id}.json`, { parse: true }); return data.map(doc => ({ From ebdbd6987b57046f82ff4baa71c8941407477112 Mon Sep 17 00:00:00 2001 From: capitanwesler Date: Mon, 8 Feb 2021 22:11:23 +0000 Subject: [PATCH 7/9] Deleting fuzzball, unused --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index d5bfac1..faf29fe 100644 --- a/package.json +++ b/package.json @@ -47,10 +47,9 @@ "compose-middleware": "^5.0.1", "cors": "^2.8.5", "express": "^4.17.1", - "fuzzball": "^1.3.1", "got": "^11.8.1", "helmet": "^4.3.1", "rss-to-json": "^1.1.2", "tough-cookie": "^4.0.0" } -} +} \ No newline at end of file From 55b09858a3608968181b4090148851781a808313 Mon Sep 17 00:00:00 2001 From: capitanwesler Date: Tue, 9 Feb 2021 22:23:43 +0000 Subject: [PATCH 8/9] Fixing some issues with the directory.json in the v2 of the api --- src/v2/api/api.js | 32 ++++++++++++++++++-------------- src/v2/utils/index.js | 38 +++++++++++++++++++++++--------------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/v2/api/api.js b/src/v2/api/api.js index f54a85d..11754ea 100644 --- a/src/v2/api/api.js +++ b/src/v2/api/api.js @@ -62,7 +62,7 @@ const top = async (type, subtype, page) =>{ const getAllAnimes = async () =>{ - let data = await getAnimes() + let data = await getAnimes(); return data.map(item => ({ index: item[0], @@ -78,7 +78,7 @@ const getAllDirectory = async (genres) =>{ return await getDirectory(genres); }; const getAnitakume = async () =>{ - const promises = [] + const promises = []; await rss.load(BASE_IVOOX).then(rss => { @@ -121,7 +121,7 @@ const getNews = async (pageRss) =>{ await rss.load(pageRss[i].url).then(rss => { - const body = JSON.parse(JSON.stringify(rss, null, 3)).items + const body = JSON.parse(JSON.stringify(rss, null, 3)).items; body.map(doc => { promises.push({ @@ -247,9 +247,13 @@ const getMoreInfo = async (title) =>{ try { const promises = []; - - let data = directoryAnimes; - const res = data.filter(x => x.title === title)[0]; + const res = directoryAnimes.filter(x => { + if (x.title === title) { + return x; + } else { + return x.title === `${title} (TV)` ? x : undefined; + } + })[0]; if (!res.jkanime) { promises.push({ @@ -307,7 +311,7 @@ const getImages = async (query) => { let options = { parse: true } const data = await homgot(`${BASE_QWANT}count=${query.count}&q=${query.title}&t=${query.type}&safesearch=${query.safesearch}&locale=${query.country}&uiv=4`, options); const body = data.data.result.items; - const promises = [] + const promises = []; body.map(doc =>{ @@ -328,7 +332,7 @@ const getYoutubeVideos = async (channelId) => { let options = { parse: true } const data = await homgot(`${BASE_YOUTUBE}${channelId.id}&part=${channelId.part}&order=${channelId.order}&maxResults=${channelId.maxResults}`, options); const body = data[channelId.prop]; - const promises = [] + const promises = []; body.map(doc =>{ @@ -351,12 +355,12 @@ const getRadioStations = async () => { } const getOpAndEd = async (title) => { - let data = await parserThemes.serie(title) - return await structureThemes(data, true) + let data = await parserThemes.serie(title); + return await structureThemes(data, true); }; const getThemesYear = async (year) => { - let data = [] + let data = []; if (year === undefined) { return await parserThemes.allYears(); @@ -369,7 +373,7 @@ const getThemesYear = async (year) => { const getRandomTheme = async () => { - let promise = [] + let promise = []; let options = { parse: true } const data = await homgot(`${BASE_THEMEMOE}roulette`, options); let themes = await getThemes(data.themes) @@ -378,14 +382,14 @@ const getRandomTheme = async () => { name: data.name, title: themes[0].name, link: themes[0].video - }) + }); return promise; }; const getArtist = async (id) => { - let data + let data; if (id === undefined) { return await parserThemes.artists(); diff --git a/src/v2/utils/index.js b/src/v2/utils/index.js index af425cd..f002300 100644 --- a/src/v2/utils/index.js +++ b/src/v2/utils/index.js @@ -307,7 +307,7 @@ const searchAnime = async (query) => { const obtainAnimeSeries = async ($) => { - let promises = [] + let promises = []; await asyncForEach($('div.Container ul.ListAnimes li article'), async (element) => { @@ -472,20 +472,29 @@ const getThemes = async (themes) => { const getAnimes = async () => await homgot(`${BASE_ANIMEFLV}api/animes/list`, { parse: true }); const getDirectory = async (genres) => { - - let data - if (genres === "sfw") { - data = directoryAnimes.filter(function (item) { - return !item.genres.includes("Ecchi") && !item.genres.includes("ecchi"); - }) - } else { - data = directoryAnimes; - } - - return data.map(doc => ({ + if (genres === 'sfw') { + return directoryAnimes.filter(function (doc) { + if (!doc.genres.includes('Ecchi') && !doc.genres.includes('ecchi')) { + return { + id: doc.id, + title: doc.title, + mal_id: doc.mal_id, + poster: doc.poster, + type: doc.type, + genres: doc.genres, + state: doc.state, + score: doc.score, + jkanime: false, + description: doc.description + }; + } + }); + } + + return directoryAnimes.map(doc => ({ id: doc.id, title: doc.title, - mal_title: doc.mal_title, + mal_id: doc.mal_id, poster: doc.poster, type: doc.type, genres: doc.genres, @@ -493,8 +502,7 @@ const getDirectory = async (genres) => { score: doc.score, jkanime: false, description: doc.description - })); - + })); }; module.exports = { From c7b313857cc8f8276914889049ad5285ca197d19 Mon Sep 17 00:00:00 2001 From: capitanwesler Date: Wed, 10 Feb 2021 08:56:21 +0000 Subject: [PATCH 9/9] Adding some missing score in an anime from the directory --- src/assets/directory.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/assets/directory.json b/src/assets/directory.json index 10aaa27..5a93fa5 100644 --- a/src/assets/directory.json +++ b/src/assets/directory.json @@ -57172,6 +57172,7 @@ "Shounen" ], "state": "En emision", + "score": "4.4", "jkanime": false, "description": "Un fatídico día, toda la humanidad quedó petrificada por un destello de luz cegadora. Después de varios milenios, el estudiante de instituto Taiju se despierta y se encuentra perdido en un mundo de estatuas. Sin embargo, no está solo; su amigo, amante de la ciencia, ha estado trabajando durante unos meses y tiene un gran plan en mente: ¡poner en marcha la civilización con el poder de la ciencia!" }