From 4da121d094343c499982877b1544445ac2e15be6 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Tue, 10 Jun 2025 15:15:52 +0000 Subject: [PATCH] refactor(extractor): add return type to all extract methods --- src/extractor/DoodStream.ts | 4 ++-- src/extractor/Dropload.ts | 4 ++-- src/extractor/ExternalUrl.ts | 4 ++-- src/extractor/Fsst.ts | 4 ++-- src/extractor/Soaper.ts | 4 ++-- src/extractor/SuperVideo.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/extractor/DoodStream.ts b/src/extractor/DoodStream.ts index 75c65b8..066d33c 100644 --- a/src/extractor/DoodStream.ts +++ b/src/extractor/DoodStream.ts @@ -2,7 +2,7 @@ import randomstring from 'randomstring'; import * as cheerio from 'cheerio'; import { Extractor } from './types'; import { Fetcher } from '../utils'; -import { Context, Meta } from '../types'; +import { Context, Meta, UrlResult } from '../types'; import { NotFoundError } from '../error'; export class DoodStream implements Extractor { @@ -26,7 +26,7 @@ export class DoodStream implements Extractor { return new URL(`http://dood.to/e/${videoId}`); }; - readonly extract = async (ctx: Context, url: URL, meta: Meta) => { + readonly extract = async (ctx: Context, url: URL, meta: Meta): 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 137228d..57c1774 100644 --- a/src/extractor/Dropload.ts +++ b/src/extractor/Dropload.ts @@ -2,7 +2,7 @@ import bytes from 'bytes'; import * as cheerio from 'cheerio'; import { Extractor } from './types'; import { extractUrlFromPacked, Fetcher } from '../utils'; -import { Context, Meta } from '../types'; +import { Context, Meta, UrlResult } from '../types'; import { NotFoundError } from '../error'; export class Dropload implements Extractor { @@ -22,7 +22,7 @@ export class Dropload implements Extractor { readonly normalize = (url: URL): URL => new URL(url.href.replace('/e/', '/').replace('/embed-', '/')); - readonly extract = async (ctx: Context, url: URL, meta: Meta) => { + readonly extract = async (ctx: Context, url: URL, meta: Meta): 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 2d571f0..5b98932 100644 --- a/src/extractor/ExternalUrl.ts +++ b/src/extractor/ExternalUrl.ts @@ -1,6 +1,6 @@ import { Extractor } from './types'; import { Fetcher } from '../utils'; -import { Context, Meta } from '../types'; +import { Context, Meta, UrlResult } from '../types'; export class ExternalUrl implements Extractor { readonly id = 'external'; @@ -19,7 +19,7 @@ export class ExternalUrl implements Extractor { readonly normalize = (url: URL): URL => url; - readonly extract = async (ctx: Context, url: URL, meta: Meta) => { + readonly extract = async (ctx: Context, url: URL, meta: Meta): Promise => { // We only want to make sure that the URL is accessible await this.fetcher.head(ctx, url, { noFlareSolverr: true }); diff --git a/src/extractor/Fsst.ts b/src/extractor/Fsst.ts index 93f0920..f343a53 100644 --- a/src/extractor/Fsst.ts +++ b/src/extractor/Fsst.ts @@ -1,7 +1,7 @@ import * as cheerio from 'cheerio'; import { Extractor } from './types'; import { Fetcher } from '../utils'; -import { Context, Meta } from '../types'; +import { Context, Meta, UrlResult } from '../types'; export class Fsst implements Extractor { readonly id = 'fsst'; @@ -20,7 +20,7 @@ export class Fsst implements Extractor { readonly normalize = (url: URL): URL => url; - readonly extract = async (ctx: Context, url: URL, meta: Meta) => { + readonly extract = async (ctx: Context, url: URL, meta: Meta): Promise => { const html = await this.fetcher.text(ctx, url); const $ = cheerio.load(html); diff --git a/src/extractor/Soaper.ts b/src/extractor/Soaper.ts index a0fd676..195d751 100644 --- a/src/extractor/Soaper.ts +++ b/src/extractor/Soaper.ts @@ -1,6 +1,6 @@ import { Extractor } from './types'; import { Fetcher } from '../utils'; -import { Context, Meta } from '../types'; +import { Context, Meta, UrlResult } from '../types'; interface SoaperInfoResponsePartial { val: string; @@ -24,7 +24,7 @@ export class Soaper implements Extractor { readonly normalize = (url: URL): URL => url; - readonly extract = async (ctx: Context, url: URL, meta: Meta) => { + readonly extract = async (ctx: Context, url: URL, meta: Meta): 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 a8220f3..0f2a1a9 100644 --- a/src/extractor/SuperVideo.ts +++ b/src/extractor/SuperVideo.ts @@ -2,7 +2,7 @@ import bytes from 'bytes'; import * as cheerio from 'cheerio'; import { Extractor } from './types'; import { extractUrlFromPacked, Fetcher } from '../utils'; -import { Context, Meta } from '../types'; +import { Context, Meta, UrlResult } from '../types'; export class SuperVideo implements Extractor { readonly id = 'supervideo'; @@ -21,7 +21,7 @@ export class SuperVideo implements Extractor { readonly normalize = (url: URL): URL => new URL(url.href.replace('/e/', '/').replace('/embed-', '/')); - readonly extract = async (ctx: Context, url: URL, meta: Meta) => { + readonly extract = async (ctx: Context, url: URL, meta: Meta): Promise => { const html = await this.fetcher.text(ctx, url); const heightAndSizeMatch = html.match(/\d{3,}x(\d{3,}), ([\d.]+ ?[GM]B)/) as string[];