feat(torrents): Toloka section filter by show type, year scope for movies only
This commit is contained in:
1 parent
c52d798221
commit
f642dad64e
5 files changed
+56
-13
No files matched your search
@@ -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 (_) {
|
||||
|
||||
Reference in new issue
Block a user