mirror of
https://github.com/YuzuZensai/play-dl-test.git
synced 2026-01-31 14:58:05 +00:00
search validation added
This commit is contained in:
@@ -71,12 +71,10 @@ export async function stream(url: string, options: StreamOptions = {}): Promise<
|
||||
if (typeof options.quality !== 'number') options.quality = audioFormat.length - 1;
|
||||
else if (options.quality <= 0) options.quality = 0;
|
||||
else if (options.quality >= audioFormat.length) options.quality = audioFormat.length - 1;
|
||||
if(audioFormat.length !== 0) final.push(audioFormat[options.quality]);
|
||||
else final.push(info.format[info.format.length - 1])
|
||||
if (audioFormat.length !== 0) final.push(audioFormat[options.quality]);
|
||||
else final.push(info.format[info.format.length - 1]);
|
||||
let type: StreamType =
|
||||
final[0].codec === 'opus' && final[0].container === 'webm'
|
||||
? StreamType.WebmOpus
|
||||
: StreamType.Arbitrary;
|
||||
final[0].codec === 'opus' && final[0].container === 'webm' ? StreamType.WebmOpus : StreamType.Arbitrary;
|
||||
return new Stream(
|
||||
final[0].url,
|
||||
type,
|
||||
@@ -110,12 +108,10 @@ export async function stream_from_info(info: InfoData, options: StreamOptions =
|
||||
if (typeof options.quality !== 'number') options.quality = audioFormat.length - 1;
|
||||
else if (options.quality <= 0) options.quality = 0;
|
||||
else if (options.quality >= audioFormat.length) options.quality = audioFormat.length - 1;
|
||||
if(audioFormat.length !== 0) final.push(audioFormat[options.quality]);
|
||||
else final.push(info.format[info.format.length - 1])
|
||||
if (audioFormat.length !== 0) final.push(audioFormat[options.quality]);
|
||||
else final.push(info.format[info.format.length - 1]);
|
||||
let type: StreamType =
|
||||
final[0].codec === 'opus' && final[0].container === 'webm'
|
||||
? StreamType.WebmOpus
|
||||
: StreamType.Arbitrary;
|
||||
final[0].codec === 'opus' && final[0].container === 'webm' ? StreamType.WebmOpus : StreamType.Arbitrary;
|
||||
return new Stream(
|
||||
final[0].url,
|
||||
type,
|
||||
|
||||
Reference in New Issue
Block a user