feat: added torrents and similar for every movie

This commit is contained in:
ner committed 2023-08-18 12:36:10 +03:00
1 parent ada725072f
commit 8bff4d6d80
16 files changed
+91 -117

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
import axios, { AxiosInstance } from 'axios';
import { parse } from 'node-html-parser';
enum ORDER {
export enum ORDER {
size = 5,
seeders = 7
}
+5 -2
View File
@@ -1,12 +1,15 @@
import { NextResponse } from 'next/server';
import pirateBay from '../parsers/pirate-bay';
import pirateBay, { ORDER } from '../parsers/pirate-bay';
export async function GET(request: Request) {
const params = Object.fromEntries(new URL(request.url).searchParams.entries());
try {
const torrents = await pirateBay.search({ query: params.query });
const torrents = await pirateBay.search({
query: params.query,
order: parseInt(params.order || `${ORDER.seeders}`)
});
return NextResponse.json(torrents);
} catch (error) {
return NextResponse.json([]);