init: toloka
This commit is contained in:
1 parent
be9a128793
commit
345cf911a4
5 files changed
+48
-60
No files matched your search
+1
-54
@@ -5,11 +5,8 @@ import { cookies } from 'next/headers';
|
||||
import { createUniqueRandomGenerator } from '@/lib/utils';
|
||||
|
||||
import mapMoviesSeriesResponseToShows, { mapMovieSeriesToShow } from './dto/Show';
|
||||
import pirateBay from './parsers/pirate-bay';
|
||||
import toloka from './parsers/toloka';
|
||||
import yts from './parsers/yts';
|
||||
import http from './Http';
|
||||
import { Sort } from './parsers';
|
||||
|
||||
const session = () => cookies().get('session')?.value;
|
||||
|
||||
@@ -238,54 +235,4 @@ export const credits = async ({
|
||||
});
|
||||
};
|
||||
|
||||
export const trailers = async ({
|
||||
showId,
|
||||
showType
|
||||
}: {
|
||||
showId: Show['id'];
|
||||
showType?: Show['type'];
|
||||
}): Promise<Trailer[]> => {
|
||||
return http
|
||||
.get<{ id: number; results: Trailer[] }>(`/${showType}/${showId}/videos`, {
|
||||
params: {
|
||||
language: 'en-US'
|
||||
}
|
||||
})
|
||||
.then((data) => data.results);
|
||||
};
|
||||
|
||||
export const YTSTorrents = async ({ query, sort, imdbID }: { imdbID: string; query: string; sort: Sort }) => {
|
||||
try {
|
||||
return yts.search({
|
||||
imdbID,
|
||||
query,
|
||||
sort
|
||||
});
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const TPBTorrents = async ({ query, sort }: { imdbID: string; query: string; sort: Sort }) => {
|
||||
try {
|
||||
return pirateBay.search({
|
||||
query,
|
||||
sort
|
||||
});
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const TLKTorrents = async ({ query, sort }: { imdbID: string; query: string; sort: Sort }) => {
|
||||
try {
|
||||
return toloka.search({
|
||||
query,
|
||||
sort
|
||||
});
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchTLKMagnet = async (url: string) => toloka.magnet(url);
|
||||
export const fetchTLKMagnet = async (url: string) => toloka.magnet(url);
|
||||
@@ -18,7 +18,7 @@ export class Toloka {
|
||||
this.host = host;
|
||||
this.client = axios.create({
|
||||
baseURL: this.host,
|
||||
headers: { Cookie: 'toloka_sid=0504c23f6b4fc00d39530cfa78f8d767; toloka_ssl=1' }
|
||||
headers: { Cookie: 'toloka_sid=e9693224d00c5b60af50c2596d1b880d; toloka_ssl=1' }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user