migrate to esm structure

This commit is contained in:
TheBeastLT
2023-10-31 14:21:04 +02:00
parent c7fa8e9c50
commit 86cf502725
30 changed files with 242 additions and 311 deletions

View File

@@ -1,14 +1,14 @@
const AllDebridClient = require('all-debrid-api');
const { Type } = require('../lib/types');
const { isVideo, isArchive } = require('../lib/extension');
const StaticResponse = require('./static');
const { getMagnetLink } = require('../lib/magnetHelper');
const { BadTokenError, AccessDeniedError } = require('./mochHelper');
import AllDebridClient from 'all-debrid-api';
import { Type } from '../lib/types.js';
import { isVideo, isArchive } from '../lib/extension.js';
import StaticResponse from './static.js';
import { getMagnetLink } from '../lib/magnetHelper.js';
import { BadTokenError, AccessDeniedError } from './mochHelper.js';
const KEY = 'alldebrid';
const AGENT = 'torrentio';
async function getCachedStreams(streams, apiKey) {
export async function getCachedStreams(streams, apiKey) {
const options = await getDefaultOptions();
const AD = new AllDebridClient(apiKey, options);
const hashes = streams.map(stream => stream.infoHash);
@@ -23,7 +23,7 @@ async function getCachedStreams(streams, apiKey) {
console.warn(`Failed AllDebrid cached [${hashes[0]}] torrent availability request:`, error);
return undefined;
});
return available && available.data && available.data.magnets && streams
return available?.data?.magnets && streams
.reduce((mochStreams, stream) => {
const cachedEntry = available.data.magnets.find(magnet => stream.infoHash === magnet.hash.toLowerCase());
const streamTitleParts = stream.title.replace(/\n👤.*/s, '').split('\n');
@@ -32,13 +32,13 @@ async function getCachedStreams(streams, apiKey) {
const encodedFileName = encodeURIComponent(fileName);
mochStreams[stream.infoHash] = {
url: `${apiKey}/${stream.infoHash}/${encodedFileName}/${fileIndex}`,
cached: cachedEntry && cachedEntry.instant
cached: cachedEntry?.instant
}
return mochStreams;
}, {})
}
async function getCatalog(apiKey, offset = 0) {
export async function getCatalog(apiKey, offset = 0) {
if (offset > 0) {
return [];
}
@@ -55,7 +55,7 @@ async function getCatalog(apiKey, offset = 0) {
})));
}
async function getItemMeta(itemId, apiKey) {
export async function getItemMeta(itemId, apiKey) {
const options = await getDefaultOptions();
const AD = new AllDebridClient(apiKey, options);
return AD.magnet.status(itemId)
@@ -76,7 +76,7 @@ async function getItemMeta(itemId, apiKey) {
}))
}
async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
export async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
console.log(`Unrestricting AllDebrid ${infoHash} [${fileIndex}]`);
const options = await getDefaultOptions(ip);
const AD = new AllDebridClient(apiKey, options);
@@ -186,5 +186,3 @@ function errorExpiredSubscriptionError(error) {
return ['AUTH_BAD_APIKEY', 'MUST_BE_PREMIUM', 'MAGNET_MUST_BE_PREMIUM', 'FREE_TRIAL_LIMIT_REACHED', 'AUTH_USER_BANNED']
.includes(error.code);
}
module.exports = { getCachedStreams, resolve, getCatalog, getItemMeta };

View File

@@ -1,14 +1,13 @@
const DebridLinkClient = require('debrid-link-api');
const { Type } = require('../lib/types');
const { isVideo, isArchive } = require('../lib/extension');
const { delay } = require('../lib/promises');
const StaticResponse = require('./static');
const { getMagnetLink } = require('../lib/magnetHelper');
const { chunkArray, BadTokenError } = require('./mochHelper');
import DebridLinkClient from 'debrid-link-api';
import { Type } from '../lib/types.js';
import { isVideo, isArchive } from '../lib/extension.js';
import StaticResponse from './static.js';
import { getMagnetLink } from '../lib/magnetHelper.js';
import { chunkArray, BadTokenError } from './mochHelper.js';
const KEY = 'debridlink';
async function getCachedStreams(streams, apiKey) {
export async function getCachedStreams(streams, apiKey) {
const options = await getDefaultOptions();
const DL = new DebridLinkClient(apiKey, options);
const hashBatches = chunkArray(streams.map(stream => stream.infoHash), 50)
@@ -34,7 +33,7 @@ async function getCachedStreams(streams, apiKey) {
}, {})
}
async function getCatalog(apiKey, offset = 0) {
export async function getCatalog(apiKey, offset = 0) {
if (offset > 0) {
return [];
}
@@ -51,7 +50,7 @@ async function getCatalog(apiKey, offset = 0) {
})));
}
async function getItemMeta(itemId, apiKey, ip) {
export async function getItemMeta(itemId, apiKey, ip) {
const options = await getDefaultOptions(ip);
const DL = new DebridLinkClient(apiKey, options);
return DL.seedbox.list(itemId)
@@ -72,7 +71,7 @@ async function getItemMeta(itemId, apiKey, ip) {
}))
}
async function resolve({ ip, apiKey, infoHash, fileIndex }) {
export async function resolve({ ip, apiKey, infoHash, fileIndex }) {
console.log(`Unrestricting DebridLink ${infoHash} [${fileIndex}]`);
const options = await getDefaultOptions(ip);
const DL = new DebridLinkClient(apiKey, options);
@@ -147,5 +146,3 @@ function statusReady(torrent) {
function errorExpiredSubscriptionError(error) {
return ['freeServerOverload', 'maxTorrent', 'maxLink', 'maxLinkHost', 'maxData', 'maxDataHost'].includes(error);
}
module.exports = { getCachedStreams, resolve, getCatalog, getItemMeta };

View File

@@ -1,21 +1,21 @@
const namedQueue = require('named-queue');
const options = require('./options');
const realdebrid = require('./realdebrid');
const premiumize = require('./premiumize');
const alldebrid = require('./alldebrid');
const debridlink = require('./debridlink');
const offcloud = require('./offcloud');
const putio = require('./putio');
const StaticResponse = require('./static');
const { cacheWrapResolvedUrl } = require('../lib/cache');
const { timeout } = require('../lib/promises');
const { BadTokenError, streamFilename, AccessDeniedError, enrichMeta } = require('./mochHelper');
const { isStaticUrl } = require("./static");
import namedQueue from 'named-queue';
import * as options from './options.js';
import * as realdebrid from './realdebrid.js';
import * as premiumize from './premiumize.js';
import * as alldebrid from './alldebrid.js';
import * as debridlink from './debridlink.js';
import * as offcloud from './offcloud.js';
import * as putio from './putio.js';
import StaticResponse from './static.js';
import { cacheWrapResolvedUrl } from '../lib/cache.js';
import { timeout } from '../lib/promises.js';
import { BadTokenError, streamFilename, AccessDeniedError, enrichMeta } from './mochHelper.js';
import { isStaticUrl } from './static.js';
const RESOLVE_TIMEOUT = 2 * 60 * 1000; // 2 minutes
const MIN_API_KEY_SYMBOLS = 15;
const TOKEN_BLACKLIST = [];
const MOCHS = {
export const MochOptions = {
realdebrid: {
key: 'realdebrid',
instance: realdebrid,
@@ -64,17 +64,17 @@ const unrestrictQueue = new namedQueue((task, callback) => task.method()
.then(result => callback(false, result))
.catch((error => callback(error))), 20);
function hasMochConfigured(config) {
return Object.keys(MOCHS).find(moch => config?.[moch])
export function hasMochConfigured(config) {
return Object.keys(MochOptions).find(moch => config?.[moch])
}
async function applyMochs(streams, config) {
export async function applyMochs(streams, config) {
if (!streams?.length || !hasMochConfigured(config)) {
return streams;
}
return Promise.all(Object.keys(config)
.filter(configKey => MOCHS[configKey])
.map(configKey => MOCHS[configKey])
.filter(configKey => MochOptions[configKey])
.map(configKey => MochOptions[configKey])
.map(moch => {
if (isInvalidToken(config[moch.key], moch.key)) {
return { moch, error: BadTokenError };
@@ -91,8 +91,8 @@ async function applyMochs(streams, config) {
.then(results => processMochResults(streams, config, results));
}
async function resolve(parameters) {
const moch = MOCHS[parameters.mochKey];
export async function resolve(parameters) {
const moch = MochOptions[parameters.mochKey];
if (!moch) {
return Promise.reject(new Error(`Not a valid moch provider: ${parameters.mochKey}`));
}
@@ -112,8 +112,8 @@ async function resolve(parameters) {
}));
}
async function getMochCatalog(mochKey, config) {
const moch = MOCHS[mochKey];
export async function getMochCatalog(mochKey, config) {
const moch = MochOptions[mochKey];
if (!moch) {
return Promise.reject(new Error(`Not a valid moch provider: ${mochKey}`));
}
@@ -123,8 +123,8 @@ async function getMochCatalog(mochKey, config) {
return moch.instance.getCatalog(config[moch.key], config.skip, config.ip);
}
async function getMochItemMeta(mochKey, itemId, config) {
const moch = MOCHS[mochKey];
export async function getMochItemMeta(mochKey, itemId, config) {
const moch = MochOptions[mochKey];
if (!moch) {
return Promise.reject(new Error(`Not a valid moch provider: ${mochKey}`));
}
@@ -212,19 +212,17 @@ function blackListToken(token, mochKey) {
function errorStreamResponse(mochKey, error, config) {
if (error === BadTokenError) {
return {
name: `Torrentio\n${MOCHS[mochKey].shortName} error`,
title: `Invalid ${MOCHS[mochKey].name} ApiKey/Token!`,
name: `Torrentio\n${MochOptions[mochKey].shortName} error`,
title: `Invalid ${MochOptions[mochKey].name} ApiKey/Token!`,
url: `${config.host}/${StaticResponse.FAILED_ACCESS}`
};
}
if (error === AccessDeniedError) {
return {
name: `Torrentio\n${MOCHS[mochKey].shortName} error`,
title: `Expired/invalid ${MOCHS[mochKey].name} subscription!`,
name: `Torrentio\n${MochOptions[mochKey].shortName} error`,
title: `Expired/invalid ${MochOptions[mochKey].name} subscription!`,
url: `${config.host}/${StaticResponse.FAILED_ACCESS}`
};
}
return undefined;
}
module.exports = { applyMochs, getMochCatalog, getMochItemMeta, resolve, hasMochConfigured, MochOptions: MOCHS }

View File

@@ -1,16 +1,16 @@
const repository = require('../lib/repository')
import * as repository from '../lib/repository.js';
const METAHUB_URL = 'https://images.metahub.space'
const BadTokenError = { code: 'BAD_TOKEN' }
const AccessDeniedError = { code: 'ACCESS_DENIED' }
export const BadTokenError = { code: 'BAD_TOKEN' }
export const AccessDeniedError = { code: 'ACCESS_DENIED' }
function chunkArray(arr, size) {
export function chunkArray(arr, size) {
return arr.length > size
? [arr.slice(0, size), ...chunkArray(arr.slice(size), size)]
: [arr];
}
function streamFilename(stream) {
export function streamFilename(stream) {
const titleParts = stream.title.replace(/\n👤.*/s, '').split('\n');
const filePath = titleParts.pop();
const filename = titleParts.length
@@ -19,7 +19,7 @@ function streamFilename(stream) {
return encodeURIComponent(filename)
}
async function enrichMeta(itemMeta) {
export async function enrichMeta(itemMeta) {
const infoHashes = [...new Set([itemMeta.infoHash]
.concat(itemMeta.videos.map(video => video.infoHash))
.filter(infoHash => infoHash))];
@@ -33,7 +33,7 @@ async function enrichMeta(itemMeta) {
background: commonImdbId && `${METAHUB_URL}/background/medium/${commonImdbId}/img`,
videos: itemMeta.videos.map(video => {
const file = files.find(file => video.title.includes(file.title));
if (file && file.imdbId) {
if (file?.imdbId) {
if (file.imdbSeason && file.imdbEpisode) {
video.id = `${file.imdbId}:${file.imdbSeason}:${file.imdbEpisode}`;
video.season = file.imdbSeason;
@@ -54,5 +54,3 @@ async function enrichMeta(itemMeta) {
function mostCommonValue(array) {
return array.sort((a, b) => array.filter(v => v === a).length - array.filter(v => v === b).length).pop();
}
module.exports = { chunkArray, streamFilename, enrichMeta, BadTokenError, AccessDeniedError }

View File

@@ -1,13 +1,13 @@
const OffcloudClient = require('offcloud-api');
const { Type } = require('../lib/types');
const { isVideo } = require('../lib/extension');
const StaticResponse = require('./static');
const { getMagnetLink } = require('../lib/magnetHelper');
const { chunkArray, BadTokenError } = require('./mochHelper');
import OffcloudClient from 'offcloud-api';
import { Type } from '../lib/types.js';
import { isVideo } from '../lib/extension.js';
import StaticResponse from './static.js';
import { getMagnetLink } from '../lib/magnetHelper.js';
import { chunkArray, BadTokenError } from './mochHelper.js';
const KEY = 'offcloud';
async function getCachedStreams(streams, apiKey) {
export async function getCachedStreams(streams, apiKey) {
const options = await getDefaultOptions();
const OC = new OffcloudClient(apiKey, options);
const hashBatches = chunkArray(streams.map(stream => stream.infoHash), 100);
@@ -36,7 +36,7 @@ async function getCachedStreams(streams, apiKey) {
}, {})
}
async function getCatalog(apiKey, offset = 0) {
export async function getCatalog(apiKey, offset = 0) {
if (offset > 0) {
return [];
}
@@ -52,7 +52,7 @@ async function getCatalog(apiKey, offset = 0) {
})));
}
async function getItemMeta(itemId, apiKey, ip) {
export async function getItemMeta(itemId, apiKey, ip) {
const options = await getDefaultOptions(ip);
const OC = new OffcloudClient(apiKey, options);
const torrents = await OC.cloud.history();
@@ -74,7 +74,7 @@ async function getItemMeta(itemId, apiKey, ip) {
}))
}
async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
export async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
console.log(`Unrestricting Offcloud ${infoHash} [${fileIndex}]`);
const options = await getDefaultOptions(ip);
const OC = new OffcloudClient(apiKey, options);
@@ -152,5 +152,3 @@ function statusReady(torrent) {
function errorExpiredSubscriptionError(error) {
return error && (error.includes('not_available') || error.includes('NOAUTH'));
}
module.exports = { getCachedStreams, resolve, getCatalog, getItemMeta };

View File

@@ -1,4 +1,4 @@
const DebridOptions = {
export const DebridOptions = {
key: 'debridoptions',
options: {
noDownloadLinks: {
@@ -16,19 +16,14 @@ const DebridOptions = {
}
}
function excludeDownloadLinks(config) {
return config[DebridOptions.key] && config[DebridOptions.key]
.includes(DebridOptions.options.noDownloadLinks.key);
export function excludeDownloadLinks(config) {
return config[DebridOptions.key]?.includes(DebridOptions.options.noDownloadLinks.key);
}
function includeTorrentLinks(config) {
return config[DebridOptions.key] && config[DebridOptions.key]
.includes(DebridOptions.options.torrentLinks.key);
export function includeTorrentLinks(config) {
return config[DebridOptions.key]?.includes(DebridOptions.options.torrentLinks.key);
}
function showDebridCatalog(config) {
return !(config[DebridOptions.key] && config[DebridOptions.key]
.includes(DebridOptions.options.noCatalog.key));
export function showDebridCatalog(config) {
return !config[DebridOptions.key]?.includes(DebridOptions.options.noCatalog.key);
}
module.exports = { DebridOptions, excludeDownloadLinks, showDebridCatalog, includeTorrentLinks }

View File

@@ -1,14 +1,14 @@
const PremiumizeClient = require('premiumize-api');
const magnet = require('magnet-uri');
const { Type } = require('../lib/types');
const { isVideo, isArchive } = require('../lib/extension');
const StaticResponse = require('./static');
const { getMagnetLink } = require('../lib/magnetHelper');
const { BadTokenError, chunkArray } = require('./mochHelper');
import PremiumizeClient from 'premiumize-api';
import magnet from 'magnet-uri';
import { Type } from '../lib/types.js';
import { isVideo, isArchive } from '../lib/extension.js';
import StaticResponse from './static.js';
import { getMagnetLink } from '../lib/magnetHelper.js';
import { BadTokenError, chunkArray } from './mochHelper.js';
const KEY = 'premiumize';
async function getCachedStreams(streams, apiKey) {
export async function getCachedStreams(streams, apiKey) {
const options = await getDefaultOptions();
const PM = new PremiumizeClient(apiKey, options);
return Promise.all(chunkArray(streams, 100)
@@ -34,13 +34,13 @@ async function _getCachedStreams(PM, apiKey, streams) {
const encodedFileName = encodeURIComponent(fileName);
mochStreams[stream.infoHash] = {
url: `${apiKey}/${stream.infoHash}/${encodedFileName}/${fileIndex}`,
cached: available && available.response[index]
cached: available?.response[index]
};
return mochStreams;
}, {}));
}
async function getCatalog(apiKey, offset = 0) {
export async function getCatalog(apiKey, offset = 0) {
if (offset > 0) {
return [];
}
@@ -57,7 +57,7 @@ async function getCatalog(apiKey, offset = 0) {
})));
}
async function getItemMeta(itemId, apiKey, ip) {
export async function getItemMeta(itemId, apiKey, ip) {
const options = await getDefaultOptions();
const PM = new PremiumizeClient(apiKey, options);
const rootFolder = await PM.folder.list(itemId, null);
@@ -89,7 +89,7 @@ async function getFolderContents(PM, itemId, ip, folderPrefix = '') {
.concat(otherContents)));
}
async function resolve({ ip, isBrowser, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
export async function resolve({ ip, isBrowser, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
console.log(`Unrestricting Premiumize ${infoHash} [${fileIndex}] for IP ${ip} from browser=${isBrowser}`);
const options = await getDefaultOptions();
const PM = new PremiumizeClient(apiKey, options);
@@ -120,7 +120,7 @@ async function _resolve(PM, infoHash, cachedEntryInfo, fileIndex, ip, isBrowser)
async function _getCachedLink(PM, infoHash, encodedFileName, fileIndex, ip, isBrowser) {
const cachedTorrent = await PM.transfer.directDownload(magnet.encode({ infoHash }), ip);
if (cachedTorrent && cachedTorrent.content && cachedTorrent.content.length) {
if (cachedTorrent?.content?.length) {
const targetFileName = decodeURIComponent(encodedFileName);
const videos = cachedTorrent.content.filter(file => isVideo(file.path));
const targetVideo = Number.isInteger(fileIndex)
@@ -178,5 +178,3 @@ function statusReady(status) {
async function getDefaultOptions(ip) {
return { timeout: 30000 };
}
module.exports = { getCachedStreams, resolve, getCatalog, getItemMeta };

View File

@@ -1,10 +1,10 @@
const PutioAPI = require('@putdotio/api-client').default
const { isVideo } = require('../lib/extension');
const { delay } = require('../lib/promises');
const StaticResponse = require('./static');
const { getMagnetLink } = require('../lib/magnetHelper');
import PutioAPI from '@putdotio/api-client'
import { isVideo } from '../lib/extension.js';
import { delay } from '../lib/promises.js';
import StaticResponse from './static.js';
import { getMagnetLink } from '../lib/magnetHelper.js';
async function getCachedStreams(streams, apiKey) {
export async function getCachedStreams(streams, apiKey) {
return streams
.reduce((mochStreams, stream) => {
const streamTitleParts = stream.title.replace(/\n👤.*/s, '').split('\n');
@@ -19,7 +19,7 @@ async function getCachedStreams(streams, apiKey) {
}, {});
}
async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
export async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
console.log(`Unrestricting Putio ${infoHash} [${fileIndex}]`);
const clientId = apiKey.replace(/@.*/, '');
const token = apiKey.replace(/.*@/, '');
@@ -28,7 +28,7 @@ async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
return _resolve(Putio, infoHash, cachedEntryInfo, fileIndex)
.catch(error => {
if (error && error.data && error.data.status_code === 401) {
if (error?.data?.status_code === 401) {
console.log(`Access denied to Putio ${infoHash} [${fileIndex}]`);
return StaticResponse.FAILED_ACCESS;
}
@@ -90,7 +90,7 @@ async function _unrestrictLink(Putio, torrent, encodedFileName, fileIndex) {
const publicToken = await _getPublicToken(Putio, targetVideo.id);
const publicFile = await Putio.File.Public(publicToken).then(response => response.data.parent);
if (!publicFile.stream_url || !publicFile.stream_url.length) {
if (!publicFile?.stream_url?.length) {
return Promise.reject(`No Putio links found for [${torrent.hash}] ${encodedFileName}`);
}
console.log(`Unrestricted Putio ${torrent.hash} [${fileIndex}] to ${publicFile.stream_url}`);
@@ -155,5 +155,3 @@ function statusProcessing(status) {
function statusReady(status) {
return ['COMPLETED', 'SEEDING'].includes(status);
}
module.exports = { getCachedStreams, resolve };

View File

@@ -1,11 +1,11 @@
const RealDebridClient = require('real-debrid-api');
const { Type } = require('../lib/types');
const { isVideo, isArchive } = require('../lib/extension');
const { delay } = require('../lib/promises');
const { cacheAvailabilityResults, getCachedAvailabilityResults } = require('../lib/cache');
const StaticResponse = require('./static');
const { getMagnetLink } = require('../lib/magnetHelper');
const { chunkArray, BadTokenError, AccessDeniedError } = require('./mochHelper');
import RealDebridClient from 'real-debrid-api';
import { Type } from '../lib/types.js';
import { isVideo, isArchive } from '../lib/extension.js';
import { delay } from '../lib/promises.js';
import { cacheAvailabilityResults, getCachedAvailabilityResults } from '../lib/cache.js';
import StaticResponse from './static.js';
import { getMagnetLink } from '../lib/magnetHelper.js';
import { chunkArray, BadTokenError, AccessDeniedError } from './mochHelper.js';
const MIN_SIZE = 5 * 1024 * 1024; // 5 MB
const CATALOG_MAX_PAGE = 1;
@@ -14,7 +14,7 @@ const NON_BLACKLIST_ERRORS = ['ESOCKETTIMEDOUT', 'EAI_AGAIN', '504 Gateway Time-
const KEY = 'realdebrid';
const DEBRID_DOWNLOADS = 'Downloads';
async function getCachedStreams(streams, apiKey) {
export async function getCachedStreams(streams, apiKey) {
const hashes = streams.map(stream => stream.infoHash);
const available = await _getInstantAvailable(hashes, apiKey);
return available && streams
@@ -100,7 +100,7 @@ function _getCachedFileIds(fileIndex, cachedResults) {
return cachedIds || [];
}
async function getCatalog(apiKey, offset, ip) {
export async function getCatalog(apiKey, offset, ip) {
if (offset > 0) {
return [];
}
@@ -123,11 +123,10 @@ async function getCatalog(apiKey, offset, ip) {
return [downloadsMeta].concat(torrentMetas)
}
async function getItemMeta(itemId, apiKey, ip) {
export async function getItemMeta(itemId, apiKey, ip) {
const options = await getDefaultOptions(ip);
const RD = new RealDebridClient(apiKey, options);
if (itemId === DEBRID_DOWNLOADS) {
// const allTorrents = await _getAllTorrents(RD).catch(() => []);
const videos = await _getAllDownloads(RD)
.then(downloads => downloads
.map(download => ({
@@ -177,7 +176,7 @@ async function _getAllDownloads(RD, page = 1) {
return RD.downloads.get(page - 1, page, CATALOG_PAGE_SIZE);
}
async function resolve({ ip, isBrowser, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
export async function resolve({ ip, isBrowser, apiKey, infoHash, cachedEntryInfo, fileIndex }) {
console.log(`Unrestricting RealDebrid ${infoHash} [${fileIndex}]`);
const options = await getDefaultOptions(ip);
const RD = new RealDebridClient(apiKey, options);
@@ -384,5 +383,3 @@ function infringingFile(error) {
async function getDefaultOptions(ip) {
return { ip, timeout: 30000 };
}
module.exports = { getCachedStreams, resolve, getCatalog, getItemMeta };

View File

@@ -8,11 +8,9 @@ const staticVideoUrls = {
FAILED_INFRINGEMENT: `videos/failed_infringement_v2.mp4`
}
function isStaticUrl(url) {
export function isStaticUrl(url) {
return Object.values(staticVideoUrls).some(videoUrl => url?.endsWith(videoUrl));
}
module.exports = {
...staticVideoUrls,
isStaticUrl
}
export default staticVideoUrls