fix(extractor): detect SuperVideo video deletion/expiration
This commit is contained in:
parent
244778058c
commit
d1da91e030
1 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue