diff --git a/eslint.config.mjs b/eslint.config.mjs index f3fa5b3..cdc3b02 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -13,4 +13,9 @@ export default tseslint.config( { ignores: ['./dist'], }, + { + rules: { + '@typescript-eslint/explicit-member-accessibility': 'error', + }, + }, ); diff --git a/src/controller/ConfigureController.ts b/src/controller/ConfigureController.ts index d3f8965..2a70292 100644 --- a/src/controller/ConfigureController.ts +++ b/src/controller/ConfigureController.ts @@ -9,7 +9,7 @@ export class ConfigureController { private readonly sources: Source[]; - constructor(sources: Source[]) { + public constructor(sources: Source[]) { this.router = Router(); this.sources = sources; diff --git a/src/controller/ManifestController.ts b/src/controller/ManifestController.ts index 8fd0fa4..36b63e9 100644 --- a/src/controller/ManifestController.ts +++ b/src/controller/ManifestController.ts @@ -8,7 +8,7 @@ export class ManifestController { private readonly sources: Source[]; - constructor(sources: Source[]) { + public constructor(sources: Source[]) { this.router = Router(); this.sources = sources; diff --git a/src/controller/StreamController.ts b/src/controller/StreamController.ts index b221f4a..76c57df 100644 --- a/src/controller/StreamController.ts +++ b/src/controller/StreamController.ts @@ -12,7 +12,7 @@ export class StreamController { private readonly sources: Source[]; private readonly streamResolver: StreamResolver; - constructor(logger: winston.Logger, sources: Source[], streams: StreamResolver) { + public constructor(logger: winston.Logger, sources: Source[], streams: StreamResolver) { this.router = Router(); this.logger = logger; diff --git a/src/error/BlockedError.ts b/src/error/BlockedError.ts index 7722bfb..a2d376d 100644 --- a/src/error/BlockedError.ts +++ b/src/error/BlockedError.ts @@ -4,7 +4,7 @@ export class BlockedError extends Error { public readonly reason: BlockedReason; public readonly headers: Record; - constructor(reason: BlockedReason, headers: Record) { + public constructor(reason: BlockedReason, headers: Record) { super(); this.reason = reason; diff --git a/src/error/HttpError.ts b/src/error/HttpError.ts index fbab7b9..28eebe4 100644 --- a/src/error/HttpError.ts +++ b/src/error/HttpError.ts @@ -3,7 +3,7 @@ export class HttpError extends Error { public readonly statusText: string; public readonly headers: Record; - constructor(status: number, statusText: string, headers: Record) { + public constructor(status: number, statusText: string, headers: Record) { super(); this.status = status; diff --git a/src/extractor/DoodStream.ts b/src/extractor/DoodStream.ts index 7fd1337..1a9e519 100644 --- a/src/extractor/DoodStream.ts +++ b/src/extractor/DoodStream.ts @@ -6,27 +6,27 @@ import { Context, CountryCode, UrlResult } from '../types'; import { NotFoundError } from '../error'; export class DoodStream implements Extractor { - readonly id = 'doodstream'; + public readonly id = 'doodstream'; - readonly label = 'DoodStream'; + public readonly label = 'DoodStream'; - readonly ttl = 900000; // 15m + public readonly ttl = 900000; // 15m private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/dood|do[0-9]go|dooodster|dooood/); + public readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/dood|do[0-9]go|dooodster|dooood/); - readonly normalize = (url: URL): URL => { + public readonly normalize = (url: URL): URL => { const videoId = url.pathname.split('/').slice(-1)[0] as string; return new URL(`http://dood.to/e/${videoId}`); }; - readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { + public readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { const html = await this.fetcher.text(ctx, new URL(url)); const passMd5Match = html.match(/\/pass_md5\/[\w-]+\/([\w-]+)/); diff --git a/src/extractor/Dropload.ts b/src/extractor/Dropload.ts index 58d778f..bf11a39 100644 --- a/src/extractor/Dropload.ts +++ b/src/extractor/Dropload.ts @@ -6,23 +6,23 @@ import { Context, CountryCode, UrlResult } from '../types'; import { NotFoundError } from '../error'; export class Dropload implements Extractor { - readonly id = 'dropload'; + public readonly id = 'dropload'; - readonly label = 'Dropload'; + public readonly label = 'Dropload'; - readonly ttl = 900000; // 15m + public readonly ttl = 900000; // 15m private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/dropload/); + public readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/dropload/); - readonly normalize = (url: URL): URL => new URL(url.href.replace('/e/', '/').replace('/embed-', '/')); + public readonly normalize = (url: URL): URL => new URL(url.href.replace('/e/', '/').replace('/embed-', '/')); - readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { + public readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { const html = await this.fetcher.text(ctx, url); if (html.includes('File Not Found')) { diff --git a/src/extractor/ExternalUrl.ts b/src/extractor/ExternalUrl.ts index 8fbb76d..1799fd9 100644 --- a/src/extractor/ExternalUrl.ts +++ b/src/extractor/ExternalUrl.ts @@ -3,23 +3,23 @@ import { Fetcher } from '../utils'; import { Context, CountryCode, UrlResult } from '../types'; export class ExternalUrl implements Extractor { - readonly id = 'external'; + public readonly id = 'external'; - readonly label = 'External'; + public readonly label = 'External'; - readonly ttl = 3600000; // 1h + public readonly ttl = 3600000; // 1h private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly supports = (ctx: Context, url: URL): boolean => !('excludeExternalUrls' in ctx.config) && null !== url.host.match(/.*/); + public readonly supports = (ctx: Context, url: URL): boolean => !('excludeExternalUrls' in ctx.config) && null !== url.host.match(/.*/); - readonly normalize = (url: URL): URL => url; + public readonly normalize = (url: URL): URL => url; - readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode, title: string | undefined): Promise => { + public readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode, title: string | undefined): Promise => { try { // Make sure the URL is accessible, but avoid causing noise and delays doing this await this.fetcher.head(ctx, url, { noFlareSolverr: true, timeout: 1000 }); diff --git a/src/extractor/ExtractorRegistry.ts b/src/extractor/ExtractorRegistry.ts index d66f9dc..2ac83fb 100644 --- a/src/extractor/ExtractorRegistry.ts +++ b/src/extractor/ExtractorRegistry.ts @@ -9,13 +9,13 @@ export class ExtractorRegistry { private readonly extractors: Extractor[]; private readonly urlResultCache: TTLCache; - constructor(logger: winston.Logger, extractors: Extractor[]) { + public constructor(logger: winston.Logger, extractors: Extractor[]) { this.logger = logger; this.extractors = extractors; this.urlResultCache = new TTLCache({ max: 1024 }); } - readonly handle = async (ctx: Context, url: URL, countryCode: CountryCode, title?: string | undefined): Promise => { + public readonly handle = async (ctx: Context, url: URL, countryCode: CountryCode, title?: string | undefined): Promise => { const extractor = this.extractors.find(extractor => extractor.supports(ctx, url)); if (!extractor) { return []; diff --git a/src/extractor/Fsst.ts b/src/extractor/Fsst.ts index b1a2ca3..28f305e 100644 --- a/src/extractor/Fsst.ts +++ b/src/extractor/Fsst.ts @@ -4,23 +4,23 @@ import { Fetcher } from '../utils'; import { Context, CountryCode, UrlResult } from '../types'; export class Fsst implements Extractor { - readonly id = 'fsst'; + public readonly id = 'fsst'; - readonly label = 'Fsst'; + public readonly label = 'Fsst'; - readonly ttl = 900000; // 15m + public readonly ttl = 900000; // 15m private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/fsst/); + public readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/fsst/); - readonly normalize = (url: URL): URL => url; + public readonly normalize = (url: URL): URL => url; - readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { + public readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { const html = await this.fetcher.text(ctx, url); const $ = cheerio.load(html); diff --git a/src/extractor/KinoGer.ts b/src/extractor/KinoGer.ts index 097cd68..1a5b82e 100644 --- a/src/extractor/KinoGer.ts +++ b/src/extractor/KinoGer.ts @@ -5,23 +5,23 @@ import { Context, CountryCode, UrlResult } from '../types'; /** @see https://github.com/Gujal00/ResolveURL/blob/master/script.module.resolveurl/lib/resolveurl/plugins/kinoger.py */ export class KinoGer implements Extractor { - readonly id = 'kinoger'; + public readonly id = 'kinoger'; - readonly label = 'KinoGer'; + public readonly label = 'KinoGer'; - readonly ttl = 900000; // 15m + public readonly ttl = 900000; // 15m private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/kinoger\.re|shiid4u\.upn\.one|moflix\.upns\.xyz|player\.upn\.one|wasuytm\.store|ultrastream\.online/); + public readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/kinoger\.re|shiid4u\.upn\.one|moflix\.upns\.xyz|player\.upn\.one|wasuytm\.store|ultrastream\.online/); - readonly normalize = (url: URL): URL => new URL(`${url.origin}/api/v1/video?id=${url.hash.slice(1)}`); + public readonly normalize = (url: URL): URL => new URL(`${url.origin}/api/v1/video?id=${url.hash.slice(1)}`); - readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { + public readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { const hexData = await this.fetcher.text(ctx, url, { headers: { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' } }); const encrypted = Buffer.from(hexData, 'hex'); diff --git a/src/extractor/Soaper.ts b/src/extractor/Soaper.ts index a3de429..c5312f6 100644 --- a/src/extractor/Soaper.ts +++ b/src/extractor/Soaper.ts @@ -8,23 +8,23 @@ interface SoaperInfoResponsePartial { } export class Soaper implements Extractor { - readonly id = 'soaper'; + public readonly id = 'soaper'; - readonly label = 'Soaper'; + public readonly label = 'Soaper'; - readonly ttl = 900000; // 15m + public readonly ttl = 900000; // 15m private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/soaper/) && null !== url.pathname.match(/^\/(episode|movie)_/); + public readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/soaper/) && null !== url.pathname.match(/^\/(episode|movie)_/); - readonly normalize = (url: URL): URL => url; + public readonly normalize = (url: URL): URL => url; - readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode, title: string | undefined): Promise => { + public readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode, title: string | undefined): Promise => { const movieOrEpisodeId = (url.pathname.match(/\/\w+_(\w+)/) as string[])[1] as string; const form = new URLSearchParams(); diff --git a/src/extractor/SuperVideo.ts b/src/extractor/SuperVideo.ts index c68e308..7b84bc6 100644 --- a/src/extractor/SuperVideo.ts +++ b/src/extractor/SuperVideo.ts @@ -6,23 +6,23 @@ import { Context, CountryCode, UrlResult } from '../types'; import { NotFoundError } from '../error'; export class SuperVideo implements Extractor { - readonly id = 'supervideo'; + public readonly id = 'supervideo'; - readonly label = 'SuperVideo'; + public readonly label = 'SuperVideo'; - readonly ttl = 900000; // 15m + public readonly ttl = 900000; // 15m private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/supervideo/); + public readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/supervideo/); - readonly normalize = (url: URL): URL => new URL(url.href.replace('/e/', '/').replace('/embed-', '/')); + public readonly normalize = (url: URL): URL => new URL(url.href.replace('/e/', '/').replace('/embed-', '/')); - readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { + public readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { const html = await this.fetcher.text(ctx, url); if (html.includes('This video can be watched as embed only')) { diff --git a/src/extractor/VidSrc.ts b/src/extractor/VidSrc.ts index b3842b4..44cd427 100644 --- a/src/extractor/VidSrc.ts +++ b/src/extractor/VidSrc.ts @@ -6,23 +6,23 @@ import { Context, CountryCode, UrlResult } from '../types'; import { NotFoundError } from '../error'; export class VidSrc implements Extractor { - readonly id = 'vidsrc'; + public readonly id = 'vidsrc'; - readonly label = 'VidSrc'; + public readonly label = 'VidSrc'; - readonly ttl = 900000; // 15m + public readonly ttl = 900000; // 15m private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/vidsrc/); + public readonly supports = (_ctx: Context, url: URL): boolean => null !== url.host.match(/vidsrc/); - readonly normalize = (url: URL): URL => url; + public readonly normalize = (url: URL): URL => url; - readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { + public readonly extract = async (ctx: Context, url: URL, countryCode: CountryCode): Promise => { const html = await this.fetcher.text(ctx, url); const $ = cheerio.load(html); diff --git a/src/source/CineHDPlus.ts b/src/source/CineHDPlus.ts index 0bbc473..3f787de 100644 --- a/src/source/CineHDPlus.ts +++ b/src/source/CineHDPlus.ts @@ -5,21 +5,21 @@ import { Fetcher, getImdbId, Id, ImdbId } from '../utils'; import { Context, CountryCode } from '../types'; export class CineHDPlus implements Source { - readonly id = 'cinehdplus'; + public readonly id = 'cinehdplus'; - readonly label = 'CineHDPlus'; + public readonly label = 'CineHDPlus'; - readonly contentTypes: ContentType[] = ['series']; + public readonly contentTypes: ContentType[] = ['series']; - readonly countryCodes: CountryCode[] = [CountryCode.es, CountryCode.mx]; + public readonly countryCodes: CountryCode[] = [CountryCode.es, CountryCode.mx]; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const imdbId = await getImdbId(ctx, this.fetcher, id); const seriesPageUrl = await this.fetchSeriesPageUrl(ctx, imdbId); diff --git a/src/source/Eurostreaming.ts b/src/source/Eurostreaming.ts index a0c7bac..91bf5f3 100644 --- a/src/source/Eurostreaming.ts +++ b/src/source/Eurostreaming.ts @@ -5,21 +5,21 @@ import { Fetcher, getImdbId, Id, ImdbId } from '../utils'; import { Context, CountryCode } from '../types'; export class Eurostreaming implements Source { - readonly id = 'eurostreaming'; + public readonly id = 'eurostreaming'; - readonly label = 'Eurostreaming'; + public readonly label = 'Eurostreaming'; - readonly contentTypes: ContentType[] = ['series']; + public readonly contentTypes: ContentType[] = ['series']; - readonly countryCodes: CountryCode[] = [CountryCode.it]; + public readonly countryCodes: CountryCode[] = [CountryCode.it]; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const imdbId = await getImdbId(ctx, this.fetcher, id); const seriesPageUrl = await this.fetchSeriesPageUrl(ctx, imdbId); diff --git a/src/source/Frembed.ts b/src/source/Frembed.ts index 5acee28..652b586 100644 --- a/src/source/Frembed.ts +++ b/src/source/Frembed.ts @@ -4,21 +4,21 @@ import { Fetcher, getTmdbId, Id } from '../utils'; import { Context, CountryCode } from '../types'; export class Frembed implements Source { - readonly id = 'frembed'; + public readonly id = 'frembed'; - readonly label = 'Frembed'; + public readonly label = 'Frembed'; - readonly contentTypes: ContentType[] = ['series']; + public readonly contentTypes: ContentType[] = ['series']; - readonly countryCodes: CountryCode[] = [CountryCode.fr]; + public readonly countryCodes: CountryCode[] = [CountryCode.fr]; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const tmdbId = await getTmdbId(ctx, this.fetcher, id); const apiUrl = new URL(`https://frembed.space/api/series?id=${tmdbId.id}&sa=${tmdbId.season}&epi=${tmdbId.episode}&idType=tmdb`); diff --git a/src/source/FrenchCloud.ts b/src/source/FrenchCloud.ts index ac35d27..f1be68a 100644 --- a/src/source/FrenchCloud.ts +++ b/src/source/FrenchCloud.ts @@ -5,21 +5,21 @@ import { Fetcher, getImdbId, Id } from '../utils'; import { Context, CountryCode } from '../types'; export class FrenchCloud implements Source { - readonly id = 'frenchcloud'; + public readonly id = 'frenchcloud'; - readonly label = 'FrenchCloud'; + public readonly label = 'FrenchCloud'; - readonly contentTypes: ContentType[] = ['movie']; + public readonly contentTypes: ContentType[] = ['movie']; - readonly countryCodes: CountryCode[] = [CountryCode.fr]; + public readonly countryCodes: CountryCode[] = [CountryCode.fr]; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const imdbId = await getImdbId(ctx, this.fetcher, id); const pageUrl = new URL(`https://frenchcloud.cam/movie/${imdbId.id}`); diff --git a/src/source/KinoGer.ts b/src/source/KinoGer.ts index e899c71..099aca4 100644 --- a/src/source/KinoGer.ts +++ b/src/source/KinoGer.ts @@ -5,23 +5,23 @@ import { Fetcher, getTmdbId, getTmdbMovieDetails, getTmdbTvDetails, Id, TmdbId } import { Context, CountryCode } from '../types'; export class KinoGer implements Source { - readonly id = 'kinoger'; + public readonly id = 'kinoger'; - readonly label = 'KinoGer'; + public readonly label = 'KinoGer'; - readonly contentTypes: ContentType[] = ['movie', 'series']; + public readonly contentTypes: ContentType[] = ['movie', 'series']; - readonly countryCodes: CountryCode[] = [CountryCode.de]; + public readonly countryCodes: CountryCode[] = [CountryCode.de]; private readonly baseUrl = 'https://kinoger.com'; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const tmdbId = await getTmdbId(ctx, this.fetcher, id); const [keyword, year] = await this.getKeywordAndYear(ctx, tmdbId); diff --git a/src/source/MeineCloud.ts b/src/source/MeineCloud.ts index b867631..8f40e44 100644 --- a/src/source/MeineCloud.ts +++ b/src/source/MeineCloud.ts @@ -5,21 +5,21 @@ import { Fetcher, getImdbId, Id } from '../utils'; import { Context, CountryCode } from '../types'; export class MeineCloud implements Source { - readonly id = 'meinecloud'; + public readonly id = 'meinecloud'; - readonly label = 'MeineCloud'; + public readonly label = 'MeineCloud'; - readonly contentTypes: ContentType[] = ['movie']; + public readonly contentTypes: ContentType[] = ['movie']; - readonly countryCodes: CountryCode[] = [CountryCode.de]; + public readonly countryCodes: CountryCode[] = [CountryCode.de]; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const imdbId = await getImdbId(ctx, this.fetcher, id); const pageUrl = new URL(`https://meinecloud.click/movie/${imdbId.id}`); diff --git a/src/source/MostraGuarda.ts b/src/source/MostraGuarda.ts index 145ab7c..6eee42e 100644 --- a/src/source/MostraGuarda.ts +++ b/src/source/MostraGuarda.ts @@ -5,21 +5,21 @@ import { Fetcher, getImdbId, Id } from '../utils'; import { Context, CountryCode } from '../types'; export class MostraGuarda implements Source { - readonly id = 'mostraguarda'; + public readonly id = 'mostraguarda'; - readonly label = 'MostraGuarda'; + public readonly label = 'MostraGuarda'; - readonly contentTypes: ContentType[] = ['movie']; + public readonly contentTypes: ContentType[] = ['movie']; - readonly countryCodes: CountryCode[] = [CountryCode.it]; + public readonly countryCodes: CountryCode[] = [CountryCode.it]; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const imdbId = await getImdbId(ctx, this.fetcher, id); const pageUrl = new URL(`https://mostraguarda.stream/movie/${imdbId.id}`); diff --git a/src/source/Soaper.ts b/src/source/Soaper.ts index d155c95..94c0f61 100644 --- a/src/source/Soaper.ts +++ b/src/source/Soaper.ts @@ -5,23 +5,23 @@ import { Fetcher, getTmdbId, getTmdbMovieDetails, getTmdbTvDetails, Id, TmdbId } import { Context, CountryCode } from '../types'; export class Soaper implements Source { - readonly id = 'soaper'; + public readonly id = 'soaper'; - readonly label = 'Soaper'; + public readonly label = 'Soaper'; - readonly contentTypes: ContentType[] = ['movie', 'series']; + public readonly contentTypes: ContentType[] = ['movie', 'series']; - readonly countryCodes: CountryCode[] = [CountryCode.en]; + public readonly countryCodes: CountryCode[] = [CountryCode.en]; private readonly baseUrl = 'https://soaper.live'; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const tmdbId = await getTmdbId(ctx, this.fetcher, id); const [keyword, year, hrefPrefix] = await this.getKeywordYearAndHrefPrefix(ctx, tmdbId); diff --git a/src/source/StreamKiste.ts b/src/source/StreamKiste.ts index cca06d4..58ee1fb 100644 --- a/src/source/StreamKiste.ts +++ b/src/source/StreamKiste.ts @@ -5,21 +5,21 @@ import { ImdbId, Fetcher, getImdbId, Id } from '../utils'; import { Context, CountryCode } from '../types'; export class StreamKiste implements Source { - readonly id = 'streamkiste'; + public readonly id = 'streamkiste'; - readonly label = 'StreamKiste'; + public readonly label = 'StreamKiste'; - readonly contentTypes: ContentType[] = ['series']; + public readonly contentTypes: ContentType[] = ['series']; - readonly countryCodes: CountryCode[] = [CountryCode.de]; + public readonly countryCodes: CountryCode[] = [CountryCode.de]; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const imdbId = await getImdbId(ctx, this.fetcher, id); const seriesPageUrl = await this.fetchSeriesPageUrl(ctx, imdbId); diff --git a/src/source/VerHdLink.ts b/src/source/VerHdLink.ts index 10dee87..6a5538e 100644 --- a/src/source/VerHdLink.ts +++ b/src/source/VerHdLink.ts @@ -5,21 +5,21 @@ import { Fetcher, getImdbId, Id } from '../utils'; import { Context, CountryCode } from '../types'; export class VerHdLink implements Source { - readonly id = 'verhdlink'; + public readonly id = 'verhdlink'; - readonly label = 'VerHdLink'; + public readonly label = 'VerHdLink'; - readonly contentTypes: ContentType[] = ['movie']; + public readonly contentTypes: ContentType[] = ['movie']; - readonly countryCodes: CountryCode[] = [CountryCode.es, CountryCode.mx]; + public readonly countryCodes: CountryCode[] = [CountryCode.es, CountryCode.mx]; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const imdbId = await getImdbId(ctx, this.fetcher, id); const pageUrl = new URL(`https://verhdlink.cam/movie/${imdbId.id}`); diff --git a/src/source/VidSrc.ts b/src/source/VidSrc.ts index 0d55134..77120c6 100644 --- a/src/source/VidSrc.ts +++ b/src/source/VidSrc.ts @@ -4,23 +4,23 @@ import { Fetcher, getImdbId, Id } from '../utils'; import { Context, CountryCode } from '../types'; export class VidSrc implements Source { - readonly id = 'vidsrc'; + public readonly id = 'vidsrc'; - readonly label = 'VidSrc'; + public readonly label = 'VidSrc'; - readonly contentTypes: ContentType[] = ['movie', 'series']; + public readonly contentTypes: ContentType[] = ['movie', 'series']; - readonly countryCodes: CountryCode[] = [CountryCode.en]; + public readonly countryCodes: CountryCode[] = [CountryCode.en]; private readonly baseUrl = 'https://vidsrc.xyz'; private readonly fetcher: Fetcher; - constructor(fetcher: Fetcher) { + public constructor(fetcher: Fetcher) { this.fetcher = fetcher; } - readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { + public readonly handle = async (ctx: Context, _type: string, id: Id): Promise => { const imdbId = await getImdbId(ctx, this.fetcher, id); const url = imdbId.season diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index 1b095c3..2afe9ef 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -58,21 +58,21 @@ export class Fetcher { private readonly hostQueueCount = new Map(); private readonly countMutex = new Mutex(); - constructor(logger: winston.Logger) { + public constructor(logger: winston.Logger) { this.logger = logger; this.httpCache = new TTLCache(); } - readonly text = async (ctx: Context, url: URL, init?: CustomRequestInit): Promise => { + public readonly text = async (ctx: Context, url: URL, init?: CustomRequestInit): Promise => { return (await this.cachedFetch(ctx, url, init)).body; }; - readonly textPost = async (ctx: Context, url: URL, body: string, init?: CustomRequestInit): Promise => { + public readonly textPost = async (ctx: Context, url: URL, body: string, init?: CustomRequestInit): Promise => { return (await this.cachedFetch(ctx, url, { ...init, method: 'POST', body })).body; }; - readonly head = async (ctx: Context, url: URL, init?: CustomRequestInit): Promise => { + public readonly head = async (ctx: Context, url: URL, init?: CustomRequestInit): Promise => { return (await this.cachedFetch(ctx, url, { ...init, method: 'HEAD' })).policy.responseHeaders(); }; diff --git a/src/utils/StreamResolver.test.ts b/src/utils/StreamResolver.test.ts index 2b7c3d3..6326806 100644 --- a/src/utils/StreamResolver.test.ts +++ b/src/utils/StreamResolver.test.ts @@ -64,31 +64,31 @@ describe('resolve', () => { test('adds error info', async () => { class MockHandler implements Source { - readonly id = 'mockhandler'; + public readonly id = 'mockhandler'; - readonly label = 'MockHandler'; + public readonly label = 'MockHandler'; - readonly contentTypes: ContentType[] = ['movie']; + public readonly contentTypes: ContentType[] = ['movie']; - readonly countryCodes: CountryCode[] = [CountryCode.de]; + public readonly countryCodes: CountryCode[] = [CountryCode.de]; - readonly handle = async (): Promise => { + public readonly handle = async (): Promise => { return [{ countryCode: CountryCode.de, url: new URL('https://example.com') }]; }; } class MockExtractor implements Extractor { - readonly id = 'mockextractor'; + public readonly id = 'mockextractor'; - readonly label = 'MockExtractor'; + public readonly label = 'MockExtractor'; - readonly ttl = 1; + public readonly ttl = 1; - readonly supports = (): boolean => true; + public readonly supports = (): boolean => true; - readonly normalize = (url: URL): URL => url; + public readonly normalize = (url: URL): URL => url; - readonly extract = async (): Promise => + public readonly extract = async (): Promise => [ { url: new URL('https://example.com'), diff --git a/src/utils/StreamResolver.ts b/src/utils/StreamResolver.ts index 7a0ab5f..89a6437 100644 --- a/src/utils/StreamResolver.ts +++ b/src/utils/StreamResolver.ts @@ -18,12 +18,12 @@ export class StreamResolver { private readonly logger: winston.Logger; private readonly extractorRegistry: ExtractorRegistry; - constructor(logger: winston.Logger, extractorRegistry: ExtractorRegistry) { + public constructor(logger: winston.Logger, extractorRegistry: ExtractorRegistry) { this.logger = logger; this.extractorRegistry = extractorRegistry; } - readonly resolve = async (ctx: Context, sources: Source[], type: ContentType, id: Id): Promise => { + public readonly resolve = async (ctx: Context, sources: Source[], type: ContentType, id: Id): Promise => { if (sources.length === 0) { return { streams: [ diff --git a/src/utils/__mocks__/Fetcher.ts b/src/utils/__mocks__/Fetcher.ts index 2b860d9..43791a4 100644 --- a/src/utils/__mocks__/Fetcher.ts +++ b/src/utils/__mocks__/Fetcher.ts @@ -9,23 +9,23 @@ const { Fetcher } = jest.requireActual('../Fetcher'); class MockedFetcher { private readonly fetcher: typeof Fetcher; - constructor() { + public constructor() { this.fetcher = new Fetcher(winston.createLogger({ transports: [new winston.transports.Console()] })); } - readonly text = async (ctx: Context, url: URL, init?: RequestInit): Promise => { + public readonly text = async (ctx: Context, url: URL, init?: RequestInit): Promise => { const path = `${__dirname}/../__fixtures__/Fetcher/${this.slugifyUrl(url)}`; return this.fetch(path, ctx, url, init); }; - readonly textPost = async (ctx: Context, url: URL, body: string, init?: RequestInit): Promise => { + public readonly textPost = async (ctx: Context, url: URL, body: string, init?: RequestInit): Promise => { const path = `${__dirname}/../__fixtures__/Fetcher/post-${this.slugifyUrl(url)}-${slugify(body)}`; return this.fetch(path, ctx, url, { ...init, method: 'POST', body }); }; - readonly head = async (ctx: Context, url: URL, init?: RequestInit): Promise => { + public readonly head = async (ctx: Context, url: URL, init?: RequestInit): Promise => { const path = `${__dirname}/../__fixtures__/Fetcher/head-${this.slugifyUrl(url)}`; return JSON.parse(await this.fetch(path, ctx, url, { ...init, method: 'HEAD' })); diff --git a/src/utils/id/ImdbId.ts b/src/utils/id/ImdbId.ts index f9cf725..83262c3 100644 --- a/src/utils/id/ImdbId.ts +++ b/src/utils/id/ImdbId.ts @@ -3,7 +3,7 @@ export class ImdbId { public readonly season: number | undefined; public readonly episode: number | undefined; - constructor(id: string, season: number | undefined, episode: number | undefined) { + public constructor(id: string, season: number | undefined, episode: number | undefined) { this.id = id; this.season = season; this.episode = episode; diff --git a/src/utils/id/TmdbId.ts b/src/utils/id/TmdbId.ts index 6a242ce..6562c17 100644 --- a/src/utils/id/TmdbId.ts +++ b/src/utils/id/TmdbId.ts @@ -3,7 +3,7 @@ export class TmdbId { public readonly season: number | undefined; public readonly episode: number | undefined; - constructor(id: number, season: number | undefined, episode: number | undefined) { + public constructor(id: number, season: number | undefined, episode: number | undefined) { this.id = id; this.season = season; this.episode = episode;