feat(torrents): Toloka section filter by show type, year scope for movies only

This commit is contained in:
ner committed 2026-09-13 19:14:42 +03:00
1 parent c52d798221
commit f642dad64e
5 files changed
+56 -13

No files matched your search

+2 -1
View File
@@ -13,11 +13,12 @@ export async function GET({ nextUrl: { searchParams } }: NextRequest) {
const imdbID = searchParams.get('imdbID') as string;
const query = searchParams.get('query') as string;
const sort = searchParams.get('sort') as Sort;
const type = searchParams.get('type') as 'movie' | 'tv' | null;
const providers = { yts, tpb, tlk };
try {
const torrents = await providers[key].search({ imdbID, query, sort });
const torrents = await providers[key].search({ imdbID, query, sort, type: type ?? undefined });
return NextResponse.json(torrents.filter((torrent) => torrent.seeders >= MIN_SEEDERS));
} catch (_) {