feat: adding generic http downloads

This commit is contained in:
Chubby Granny Chaser 2024-07-09 19:24:02 +01:00
parent 6fce60f9f7
commit 6c6fff71fe
No known key found for this signature in database
12 changed files with 294 additions and 41 deletions

View file

@ -1,6 +1,8 @@
export enum Downloader {
RealDebrid,
Torrent,
Gofile,
PixelDrain,
}
export enum DownloadSourceStatus {
@ -63,3 +65,18 @@ export const formatName = pipe<string>(
removeDuplicateSpaces,
(str) => str.trim()
);
const realDebridHosts = ["https://1fichier.com", "https://mediafire.com"];
export const getDownloadersForUri = (uri: string) => {
if (uri.startsWith("https://gofile.io")) return [Downloader.Gofile];
if (uri.startsWith("https://pixeldrain.com")) return [Downloader.PixelDrain];
if (realDebridHosts.some((host) => uri.startsWith(host)))
return [Downloader.RealDebrid];
if (uri.startsWith("magnet:"))
return [Downloader.Torrent, Downloader.RealDebrid];
return [];
};