From df82d90a64856d078370529e1a19f831cc5d2268 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Wed, 8 Dec 2021 17:44:34 +0100 Subject: [PATCH] Actually use the optimised info fetching for the stream function --- play-dl/YouTube/stream.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/play-dl/YouTube/stream.ts b/play-dl/YouTube/stream.ts index 0a17c25..363bed6 100644 --- a/play-dl/YouTube/stream.ts +++ b/play-dl/YouTube/stream.ts @@ -1,6 +1,6 @@ -import { video_info } from '.'; import { LiveStream, Stream } from './classes/LiveStream'; -import { InfoData } from './utils/constants'; +import { InfoData, StreamInfoData } from './utils/constants'; +import { video_stream_info } from './utils/extractor'; export enum StreamType { Arbitrary = 'arbitrary', @@ -43,7 +43,7 @@ export type YouTubeStream = Stream | LiveStream; * @returns Stream class with type and stream for playing. */ export async function stream(url: string, options: StreamOptions = {}): Promise { - const info = await video_info(url, { htmldata: options.htmldata }); + const info = await video_stream_info(url, { htmldata: options.htmldata }); return await stream_from_info(info, options); } /** @@ -52,7 +52,10 @@ export async function stream(url: string, options: StreamOptions = {}): Promise< * @param options lets you add quality for stream * @returns Stream class with type and stream for playing. */ -export async function stream_from_info(info: InfoData, options: StreamOptions = {}): Promise { +export async function stream_from_info( + info: InfoData | StreamInfoData, + options: StreamOptions = {} +): Promise { const final: any[] = []; if ( info.LiveStreamData.isLive === true &&