From 38602c61ccd687eaf2593ec2a2744da9ea2b2da7 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sat, 11 Feb 2023 14:33:04 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit 21d6277 --- src/providers/anime/marin.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/providers/anime/marin.ts b/src/providers/anime/marin.ts index ae53c588f..bf7d560bb 100644 --- a/src/providers/anime/marin.ts +++ b/src/providers/anime/marin.ts @@ -23,9 +23,9 @@ class Marin extends AnimeParser { protected override classPath = 'ANIME.Marin'; private async getToken(): Promise { - let token: string[] = []; + const token: string[] = []; - let response = await axios.get('https://marin.moe/anime', { + const response = await axios.get('https://marin.moe/anime', { headers: { Referer: 'https://marin.moe/anime', Cookie: '__ddg1_=;__ddg2_=;', @@ -39,10 +39,10 @@ class Marin extends AnimeParser { } public recentEpisodes = async (page: number = 1): Promise> => { - let token = await this.getToken() + const token = await this.getToken() let data; try { - let response = await axios.post('https://marin.moe/anime',{"page" : page,"sort":"rel-d","filter":{"type":[],"status":[],"content_rating":[],"genre":[],"group":[],"production":[],"source":[],"resolution":[],"audio":[],"subtitle":[]},"search": ""}, { + const response = await axios.post('https://marin.moe/anime',{"page" : page,"sort":"rel-d","filter":{"type":[],"status":[],"content_rating":[],"genre":[],"group":[],"production":[],"source":[],"resolution":[],"audio":[],"subtitle":[]},"search": ""}, { headers: { Origin: 'https://marin.moe/', Referer: 'https://marin.moe/anime', @@ -57,7 +57,7 @@ class Marin extends AnimeParser { } catch (error) { console.log(error) } - let response_data = { + const response_data = { currentPage: page, hasNextPage: data.props.anime_list.meta.last_page > page, results: data.props.anime_list.data.map((el: any) => { @@ -77,10 +77,10 @@ class Marin extends AnimeParser { * @param query Search query */ override search = async (query: string, page: number = 1): Promise> => { - let token = await this.getToken() + const token = await this.getToken() let data; try { - let response = await axios.post('https://marin.moe/anime',{"page" : page,"sort":"az-a","filter":{"type":[],"status":[],"content_rating":[],"genre":[],"group":[],"production":[],"source":[],"resolution":[],"audio":[],"subtitle":[]},"search": query}, { + const response = await axios.post('https://marin.moe/anime',{"page" : page,"sort":"az-a","filter":{"type":[],"status":[],"content_rating":[],"genre":[],"group":[],"production":[],"source":[],"resolution":[],"audio":[],"subtitle":[]},"search": query}, { headers: { Origin: 'https://marin.moe/', Referer: 'https://marin.moe/anime', @@ -95,7 +95,7 @@ class Marin extends AnimeParser { } catch (error) { console.log(error) } - let response_data = { + const response_data = { currentPage: page, hasNextPage: data.props.anime_list.meta.last_page > page, results: data.props.anime_list.data.map((el: any) => { @@ -117,7 +117,7 @@ class Marin extends AnimeParser { override fetchAnimeInfo = async (id: string): Promise => { let data; try { - let response = await axios.get(`https://marin.moe/anime/${id}`, { + const response = await axios.get(`https://marin.moe/anime/${id}`, { headers: { Origin: 'https://marin.moe/', Referer: `https://marin.moe/anime/${id}`, @@ -135,9 +135,9 @@ class Marin extends AnimeParser { } let episodes: any[] = data.props.episode_list.data if(data.props.anime.last_episode > 36) { - let token = await this.getToken() + const token = await this.getToken() for (let index = 2; index < data.props.anime.last_episode / 36; index++) { - let response = await axios.post(`https://marin.moe/anime/${id}`, {"filter":{"episodes":true,"specials":true},"eps_page": index}, { + const response = await axios.post(`https://marin.moe/anime/${id}`, {"filter":{"episodes":true,"specials":true},"eps_page": index}, { headers: { Origin: 'https://marin.moe/', Referer: `https://marin.moe/anime/${id}`, @@ -150,14 +150,14 @@ class Marin extends AnimeParser { "x-xsrf-token": token[1].split(';')[0].replace("%3D", "="), }, }); - let data = await response.data; + const data = await response.data; console.log(data.props.episode_list.data[0]) episodes = episodes.concat(data.props.episode_list.data); } } //{"filter":{"episodes":true,"specials":true},"eps_page":2} - let response_data: IAnimeInfo = { + const response_data: IAnimeInfo = { id: id, title: { native: data.props.anime.alt_titles["Official Title"][0].text, @@ -203,7 +203,7 @@ class Marin extends AnimeParser { override fetchEpisodeSources = async (id: string, episodeNumber: number): Promise => { let data; try { - let response = await axios.get(`https://marin.moe/anime/${id}/${episodeNumber}`, { + const response = await axios.get(`https://marin.moe/anime/${id}/${episodeNumber}`, { headers: { Origin: 'https://marin.moe/', Referer: `https://marin.moe/anime/${id}/${episodeNumber}`, @@ -220,7 +220,7 @@ class Marin extends AnimeParser { console.log(error) } - let response_data = { + const response_data = { sources: data.props.video.data.mirror.map((el: any) => { return { url: el.code.file, @@ -249,6 +249,6 @@ class Marin extends AnimeParser { export default Marin; (async () => { - let marin = new Marin(); + const marin = new Marin(); console.log(await marin.recentEpisodes(1)); })();