@@ -8,7 +8,7 @@ import { StreamingServers } from '@consumet/extensions/dist/models';
88import cache from '../../utils/cache' ;
99import { redis } from '../../main' ;
1010import NineAnime from '@consumet/extensions/dist/providers/anime/9anime' ;
11- import Gogoanime from '@consumet/extensions/dist/providers/anime/gogoanime ' ;
11+ import Zoro from '@consumet/extensions/dist/providers/anime/zoro ' ;
1212
1313const routes = async ( fastify : FastifyInstance , options : RegisterOptions ) => {
1414 fastify . get ( '/' , ( _ , rp ) => {
@@ -92,15 +92,15 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
9292
9393 redis
9494 ? reply
95- . status ( 200 )
96- . send (
97- await cache . fetch (
98- redis as Redis ,
99- `anilist:trending;${ page } ;${ perPage } ` ,
100- async ( ) => await anilist . fetchTrendingAnime ( page , perPage ) ,
101- 60 * 60 ,
102- ) ,
103- )
95+ . status ( 200 )
96+ . send (
97+ await cache . fetch (
98+ redis as Redis ,
99+ `anilist:trending;${ page } ;${ perPage } ` ,
100+ async ( ) => await anilist . fetchTrendingAnime ( page , perPage ) ,
101+ 60 * 60 ,
102+ ) ,
103+ )
104104 : reply . status ( 200 ) . send ( await anilist . fetchTrendingAnime ( page , perPage ) ) ;
105105 } ) ;
106106
@@ -112,15 +112,15 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
112112
113113 redis
114114 ? reply
115- . status ( 200 )
116- . send (
117- await cache . fetch (
118- redis as Redis ,
119- `anilist:popular;${ page } ;${ perPage } ` ,
120- async ( ) => await anilist . fetchPopularAnime ( page , perPage ) ,
121- 60 * 60 ,
122- ) ,
123- )
115+ . status ( 200 )
116+ . send (
117+ await cache . fetch (
118+ redis as Redis ,
119+ `anilist:popular;${ page } ;${ perPage } ` ,
120+ async ( ) => await anilist . fetchPopularAnime ( page , perPage ) ,
121+ 60 * 60 ,
122+ ) ,
123+ )
124124 : reply . status ( 200 ) . send ( await anilist . fetchPopularAnime ( page , perPage ) ) ;
125125 } ) ;
126126
@@ -172,7 +172,7 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
172172 fastify . get (
173173 '/recent-episodes' ,
174174 async ( request : FastifyRequest , reply : FastifyReply ) => {
175- const provider = ( request . query as { provider : 'gogoanime' | ' zoro' } ) . provider ;
175+ const provider = ( request . query as { provider : 'zoro' } ) . provider ;
176176 const page = ( request . query as { page : number } ) . page ;
177177 const perPage = ( request . query as { perPage : number } ) . perPage ;
178178
@@ -224,23 +224,23 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
224224 try {
225225 redis
226226 ? reply
227- . status ( 200 )
228- . send (
229- await cache . fetch (
230- redis ,
231- `anilist:episodes;${ id } ;${ dub } ;${ fetchFiller } ;${ anilist . provider . name . toLowerCase ( ) } ` ,
232- async ( ) =>
233- anilist . fetchEpisodesListById (
234- id ,
235- dub as boolean ,
236- fetchFiller as boolean ,
237- ) ,
238- dayOfWeek === 0 || dayOfWeek === 6 ? 60 * 120 : ( 60 * 60 ) / 2 ,
239- ) ,
240- )
227+ . status ( 200 )
228+ . send (
229+ await cache . fetch (
230+ redis ,
231+ `anilist:episodes;${ id } ;${ dub } ;${ fetchFiller } ;${ anilist . provider . name . toLowerCase ( ) } ` ,
232+ async ( ) =>
233+ anilist . fetchEpisodesListById (
234+ id ,
235+ dub as boolean ,
236+ fetchFiller as boolean ,
237+ ) ,
238+ dayOfWeek === 0 || dayOfWeek === 6 ? 60 * 120 : ( 60 * 60 ) / 2 ,
239+ ) ,
240+ )
241241 : reply
242- . status ( 200 )
243- . send ( await anilist . fetchEpisodesListById ( id , dub , fetchFiller as boolean ) ) ;
242+ . status ( 200 )
243+ . send ( await anilist . fetchEpisodesListById ( id , dub , fetchFiller as boolean ) ) ;
244244 } catch ( err ) {
245245 return reply . status ( 404 ) . send ( { message : 'Anime not found' } ) ;
246246 }
@@ -277,21 +277,21 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
277277 try {
278278 redis
279279 ? reply
280- . status ( 200 )
281- . send (
282- await cache . fetch (
283- redis ,
284- `anilist:info;${ id } ;${ isDub } ;${ fetchFiller } ;${ anilist . provider . name . toLowerCase ( ) } ` ,
285- async ( ) =>
286- anilist . fetchAnimeInfo ( id , isDub as boolean , fetchFiller as boolean ) ,
287- dayOfWeek === 0 || dayOfWeek === 6 ? 60 * 120 : ( 60 * 60 ) / 2 ,
288- ) ,
289- )
280+ . status ( 200 )
281+ . send (
282+ await cache . fetch (
283+ redis ,
284+ `anilist:info;${ id } ;${ isDub } ;${ fetchFiller } ;${ anilist . provider . name . toLowerCase ( ) } ` ,
285+ async ( ) =>
286+ anilist . fetchAnimeInfo ( id , isDub as boolean , fetchFiller as boolean ) ,
287+ dayOfWeek === 0 || dayOfWeek === 6 ? 60 * 120 : ( 60 * 60 ) / 2 ,
288+ ) ,
289+ )
290290 : reply
291- . status ( 200 )
292- . send (
293- await anilist . fetchAnimeInfo ( id , isDub as boolean , fetchFiller as boolean ) ,
294- ) ;
291+ . status ( 200 )
292+ . send (
293+ await anilist . fetchAnimeInfo ( id , isDub as boolean , fetchFiller as boolean ) ,
294+ ) ;
295295 } catch ( err : any ) {
296296 reply . status ( 500 ) . send ( { message : err . message } ) ;
297297 }
@@ -326,33 +326,33 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
326326 try {
327327 redis
328328 ? reply
329- . status ( 200 )
330- . send (
331- await cache . fetch (
332- redis ,
333- `anilist:watch;${ episodeId } ;${ anilist . provider . name . toLowerCase ( ) } ;${ server } ;${ isDub ? 'dub' : 'sub' } ` ,
334- async ( ) =>
335- provider === 'zoro' || provider === 'animekai'
336- ? await anilist . fetchEpisodeSources (
337- episodeId ,
338- server ,
339- isDub ? SubOrSub . DUB : SubOrSub . SUB ,
340- )
341- : await anilist . fetchEpisodeSources ( episodeId , server ) ,
342- 600 ,
343- ) ,
344- )
345- : reply
346- . status ( 200 )
347- . send (
348- provider === 'zoro' || provider === 'animekai'
349- ? await anilist . fetchEpisodeSources (
329+ . status ( 200 )
330+ . send (
331+ await cache . fetch (
332+ redis ,
333+ `anilist:watch;${ episodeId } ;${ anilist . provider . name . toLowerCase ( ) } ;${ server } ;${ isDub ? 'dub' : 'sub' } ` ,
334+ async ( ) =>
335+ provider === 'zoro' || provider === 'animekai'
336+ ? await anilist . fetchEpisodeSources (
350337 episodeId ,
351338 server ,
352339 isDub ? SubOrSub . DUB : SubOrSub . SUB ,
353340 )
354- : await anilist . fetchEpisodeSources ( episodeId , server ) ,
355- ) ;
341+ : await anilist . fetchEpisodeSources ( episodeId , server ) ,
342+ 600 ,
343+ ) ,
344+ )
345+ : reply
346+ . status ( 200 )
347+ . send (
348+ provider === 'zoro' || provider === 'animekai'
349+ ? await anilist . fetchEpisodeSources (
350+ episodeId ,
351+ server ,
352+ isDub ? SubOrSub . DUB : SubOrSub . SUB ,
353+ )
354+ : await anilist . fetchEpisodeSources ( episodeId , server ) ,
355+ ) ;
356356
357357 anilist = new META . Anilist ( undefined , {
358358 url : process . env . PROXY as string | string [ ] ,
@@ -374,15 +374,15 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
374374 try {
375375 redis
376376 ? reply
377- . status ( 200 )
378- . send (
379- await cache . fetch (
380- redis ,
381- `anilist:staff;${ id } ` ,
382- async ( ) => await anilist . fetchStaffById ( Number ( id ) ) ,
383- 60 * 60 ,
384- ) ,
385- )
377+ . status ( 200 )
378+ . send (
379+ await cache . fetch (
380+ redis ,
381+ `anilist:staff;${ id } ` ,
382+ async ( ) => await anilist . fetchStaffById ( Number ( id ) ) ,
383+ 60 * 60 ,
384+ ) ,
385+ )
386386 : reply . status ( 200 ) . send ( await anilist . fetchStaffById ( Number ( id ) ) ) ;
387387 } catch ( err : any ) {
388388 reply . status ( 404 ) . send ( { message : err . message } ) ;
@@ -410,8 +410,8 @@ const generateAnilistMeta = (provider: string | undefined = undefined): Anilist
410410 url : process . env . PROXY as string | string [ ] ,
411411 } ) ;
412412 } else {
413- // default provider is gogoanime
414- return new Anilist ( new Gogoanime ( ) , {
413+ // default provider is Zoro
414+ return new Anilist ( new Zoro ( ) , {
415415 url : process . env . PROXY as string | string [ ] ,
416416 } ) ;
417417 }
0 commit comments