@@ -8,7 +8,7 @@ import { StreamingServers } from '@consumet/extensions/dist/models';
8
8
import cache from '../../utils/cache' ;
9
9
import { redis } from '../../main' ;
10
10
import 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 ' ;
12
12
13
13
const routes = async ( fastify : FastifyInstance , options : RegisterOptions ) => {
14
14
fastify . get ( '/' , ( _ , rp ) => {
@@ -92,15 +92,15 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
92
92
93
93
redis
94
94
? 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
+ )
104
104
: reply . status ( 200 ) . send ( await anilist . fetchTrendingAnime ( page , perPage ) ) ;
105
105
} ) ;
106
106
@@ -112,15 +112,15 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
112
112
113
113
redis
114
114
? 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
+ )
124
124
: reply . status ( 200 ) . send ( await anilist . fetchPopularAnime ( page , perPage ) ) ;
125
125
} ) ;
126
126
@@ -172,7 +172,7 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
172
172
fastify . get (
173
173
'/recent-episodes' ,
174
174
async ( request : FastifyRequest , reply : FastifyReply ) => {
175
- const provider = ( request . query as { provider : 'gogoanime' | ' zoro' } ) . provider ;
175
+ const provider = ( request . query as { provider : 'zoro' } ) . provider ;
176
176
const page = ( request . query as { page : number } ) . page ;
177
177
const perPage = ( request . query as { perPage : number } ) . perPage ;
178
178
@@ -224,23 +224,23 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
224
224
try {
225
225
redis
226
226
? 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
+ )
241
241
: 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 ) ) ;
244
244
} catch ( err ) {
245
245
return reply . status ( 404 ) . send ( { message : 'Anime not found' } ) ;
246
246
}
@@ -277,21 +277,21 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
277
277
try {
278
278
redis
279
279
? 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
+ )
290
290
: 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
+ ) ;
295
295
} catch ( err : any ) {
296
296
reply . status ( 500 ) . send ( { message : err . message } ) ;
297
297
}
@@ -326,33 +326,33 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
326
326
try {
327
327
redis
328
328
? 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 (
350
337
episodeId ,
351
338
server ,
352
339
isDub ? SubOrSub . DUB : SubOrSub . SUB ,
353
340
)
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
+ ) ;
356
356
357
357
anilist = new META . Anilist ( undefined , {
358
358
url : process . env . PROXY as string | string [ ] ,
@@ -374,15 +374,15 @@ const routes = async (fastify: FastifyInstance, options: RegisterOptions) => {
374
374
try {
375
375
redis
376
376
? 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
+ )
386
386
: reply . status ( 200 ) . send ( await anilist . fetchStaffById ( Number ( id ) ) ) ;
387
387
} catch ( err : any ) {
388
388
reply . status ( 404 ) . send ( { message : err . message } ) ;
@@ -410,8 +410,8 @@ const generateAnilistMeta = (provider: string | undefined = undefined): Anilist
410
410
url : process . env . PROXY as string | string [ ] ,
411
411
} ) ;
412
412
} else {
413
- // default provider is gogoanime
414
- return new Anilist ( new Gogoanime ( ) , {
413
+ // default provider is Zoro
414
+ return new Anilist ( new Zoro ( ) , {
415
415
url : process . env . PROXY as string | string [ ] ,
416
416
} ) ;
417
417
}
0 commit comments