bug(extractor): handle not found case properly for DoodStream
This commit is contained in:
parent
6b5c9a4ce7
commit
f3beb72f17
1 changed files with 5 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import randomstring from 'randomstring';
|
|||
import { Extractor } from './types';
|
||||
import { Fetcher } from '../utils';
|
||||
import { Context } from '../types';
|
||||
import { NotFoundError } from '../error';
|
||||
|
||||
export class DoodStream implements Extractor {
|
||||
readonly id = 'doodstream';
|
||||
|
|
@ -24,7 +25,10 @@ export class DoodStream implements Extractor {
|
|||
|
||||
const html = await this.fetcher.text(ctx, new URL(normalizedUrl));
|
||||
|
||||
const passMd5Match = html.match(/\/pass_md5\/[\w-]+\/([\w-]+)/) as string[];
|
||||
const passMd5Match = html.match(/\/pass_md5\/[\w-]+\/([\w-]+)/);
|
||||
if (!passMd5Match) {
|
||||
throw new NotFoundError();
|
||||
}
|
||||
|
||||
const token = passMd5Match[1] as string;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue