forked from JimmyLaurent/torrent-search-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
90 lines (70 loc) · 2.56 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Type definitions for torrent-search-api 2.0
// Project: https://github.com/JimmyLaurent/torrent-search-api
// Definitions by: Nicolas Girardin <https://github.com/ngirardin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Torrent {
title: string;
time: string;
size: string;
magnet: string;
desc: string;
provider: string;
}
export interface TorrentProvider {
name: string;
baseUrl: string;
requireAuthentification: boolean;
supportTokenAuthentification: boolean;
supportCookiesAuthentification: boolean;
supportCredentialsAuthentification: boolean;
loginUrl: string;
loginQueryString: string;
searchUrl: string;
categories: any; // FIXME {key: [string]}
defaultCategory: string;
resultsPerPageCount: number;
itemsSelector: string;
itemSelectors: any; // FIXME {key: [string]}
paginateSelector: string;
torrentDetailsSelector: string;
enableCloudFareBypass: boolean;
headers: any; // FIXME {key:[string]}
magnetSelector: string;
autoFixUnstableUrl: boolean;
}
export function lodProvider(providerParam: string): void;
export function loadProvider(providerParam: string | TorrentProvider): void;
export function addProvider(provider: string): void;
export function loadProviders(...args: string[]): void;
export function loadProviders(...args: TorrentProvider[]): void;
export function removeProvider(providerName: string): void;
export function enableProvider(providerName: string, args?: string[]): void;
export function enableProvider(providerName: string, ...args: string[]): void;
export function enablePublicProviders(): void;
export function disableProvider(providerName: string): void;
export function disableAllProviders(): void;
export function getProviders(): TorrentProvider[];
export function getActiveProviders(): TorrentProvider[];
export function isProviderActive(name: string): boolean;
export function search(
query: string,
category?: string,
limit?: number
): Promise<Torrent[]>;
export function search(
providers: string[],
query: string,
category: string,
limit: number
): Promise<Torrent[]>;
export function getTorrentDetails(torrent: Torrent): Promise<string>;
export function downloadTorrent(
torrent: Torrent,
filenamePath?: string
): Promise<string>;
export function overrideConfig(
providerName: string,
newConfig: TorrentProvider
): Promise<string>;
export function getMagnet(torrent: Torrent): Promise<string>;
export function getProvider(name: string, throwOnError: boolean): string;