refactor: use url.href instead of url.toString()
This commit is contained in:
parent
16b01a57fd
commit
b790cc7954
4 changed files with 5 additions and 5 deletions
|
|
@ -19,7 +19,7 @@ export class Dropload implements Extractor {
|
|||
readonly supports = (url: URL): boolean => null !== url.host.match(/dropload/);
|
||||
|
||||
readonly extract = async (ctx: Context, url: URL, countryCode: string) => {
|
||||
const normalizedUrl = url.toString().replace('/e/', '').replace('/embed-', '/');
|
||||
const normalizedUrl = url.href.replace('/e/', '').replace('/embed-', '/');
|
||||
const html = await this.fetcher.text(ctx, new URL(normalizedUrl));
|
||||
|
||||
const heightMatch = html.match(/\d{3,}x(\d{3,}),/) as string[];
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ export class Mixdrop implements Extractor {
|
|||
readonly supports = (url: URL): boolean => null !== url.host.match(/mixdrop/);
|
||||
|
||||
readonly extract = async (ctx: Context, url: URL, countryCode: string) => {
|
||||
const normalizedFullUrl = url.toString().replace('/e/', '/f/');
|
||||
const normalizedFullUrl = url.href.replace('/e/', '/f/');
|
||||
const fullHtml = await this.fetcher.text(ctx, new URL(normalizedFullUrl));
|
||||
|
||||
const sizeMatch = fullHtml.match(/([\d.]+ ?[GM]B)/) as string[];
|
||||
|
||||
const normalizedEmbedUrl = url.toString().replace('/f/', '/e/');
|
||||
const normalizedEmbedUrl = url.href.replace('/f/', '/e/');
|
||||
const embedHtml = await this.fetcher.text(ctx, new URL(normalizedEmbedUrl));
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export class SuperVideo implements Extractor {
|
|||
readonly supports = (url: URL): boolean => null !== url.host.match(/supervideo/);
|
||||
|
||||
readonly extract = async (ctx: Context, url: URL, countryCode: string) => {
|
||||
const normalizedUrl = url.toString().replace('/e/', '/').replace('/embed-', '/');
|
||||
const normalizedUrl = url.href.replace('/e/', '/').replace('/embed-', '/');
|
||||
const html = await this.fetcher.text(ctx, new URL(normalizedUrl));
|
||||
|
||||
const heightAndSizeMatch = html.match(/\d{3,}x(\d{3,}), ([\d.]+ ?[GM]B)/) as string[];
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export class StreamResolver {
|
|||
}
|
||||
|
||||
return {
|
||||
url: urlResult.url.toString(),
|
||||
url: urlResult.url.href,
|
||||
name,
|
||||
title,
|
||||
behaviorHints: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue