fix(extractor): detect SuperVideo video deletion/expiration

This commit is contained in:
WebStreamr 2025-06-12 12:06:15 +00:00
parent 244778058c
commit d1da91e030
No known key found for this signature in database

View file

@ -3,6 +3,7 @@ import * as cheerio from 'cheerio';
import { Extractor } from './types';
import { extractUrlFromPacked, Fetcher } from '../utils';
import { Context, Meta, UrlResult } from '../types';
import { NotFoundError } from '../error';
export class SuperVideo implements Extractor {
readonly id = 'supervideo';
@ -28,6 +29,11 @@ export class SuperVideo implements Extractor {
return await this.extract(ctx, new URL(`/e${url.pathname}`, url.origin), meta);
}
/* istanbul ignore next TODO: Add test after refactoring. E.g. https://supervideo.cc/ndf5shmy9lpt */
if (/'The file was deleted|The file expired/.test(html)) {
throw new NotFoundError();
}
const heightAndSizeMatch = html.match(/\d{3,}x(\d{3,}), ([\d.]+ ?[GM]B)/);
const $ = cheerio.load(html);