fix: toloka auth
This commit is contained in:
1 parent
335e26aa76
commit
1111712d2c
13 files changed
+613
-230
No files matched your search
@@ -1,17 +1,18 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
import { Sort } from '@/api/parsers';
|
||||
import pirateBay from '@/api/parsers/pirate-bay';
|
||||
import toloka from '@/api/parsers/toloka';
|
||||
import tlk from '@/api/parsers/tlk';
|
||||
import tpb from '@/api/parsers/tpb';
|
||||
import yts from '@/api/parsers/yts';
|
||||
|
||||
export async function GET({ nextUrl: { searchParams } }: NextRequest) {
|
||||
const key = searchParams.get('key') as keyof typeof providers;
|
||||
|
||||
const imdbID = searchParams.get('imdbID') as string;
|
||||
const query = searchParams.get('query') as string;
|
||||
const sort = searchParams.get('sort') as Sort;
|
||||
|
||||
const providers = { yts: yts, tpb: pirateBay, tlk: toloka };
|
||||
const providers = { yts, tpb, tlk };
|
||||
|
||||
try {
|
||||
return NextResponse.json(await providers[key].search({ imdbID, query, sort }));
|
||||
|
||||
Reference in new issue
Block a user