From e1b0d14477727a3a6010ba894bf21a7ec79b07f1 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sun, 26 Dec 2021 17:28:37 +0100 Subject: [PATCH] Improve stream retry performance by using video_stream_info --- play-dl/YouTube/classes/LiveStream.ts | 6 +++--- play-dl/YouTube/classes/SeekStream.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/play-dl/YouTube/classes/LiveStream.ts b/play-dl/YouTube/classes/LiveStream.ts index 918ef14..988991f 100644 --- a/play-dl/YouTube/classes/LiveStream.ts +++ b/play-dl/YouTube/classes/LiveStream.ts @@ -2,7 +2,7 @@ import { Readable } from 'node:stream'; import { IncomingMessage } from 'node:http'; import { parseAudioFormats, StreamOptions, StreamType } from '../stream'; import { request, request_stream } from '../../Request'; -import { video_info } from '..'; +import { video_stream_info } from '../utils/extractor'; export interface FormatInterface { url: string; @@ -98,7 +98,7 @@ export class LiveStream { * Used by dash_timer for updating dash_url every 30 minutes. */ private async dash_updater() { - const info = await video_info(this.video_url); + const info = await video_stream_info(this.video_url); if ( info.LiveStreamData.isLive === true && info.LiveStreamData.hlsManifestUrl !== null && @@ -277,7 +277,7 @@ export class Stream { * Retry if we get 404 or 403 Errors. */ private async retry() { - const info = await video_info(this.video_url); + const info = await video_stream_info(this.video_url); const audioFormat = parseAudioFormats(info.format); this.url = audioFormat[this.quality].url; } diff --git a/play-dl/YouTube/classes/SeekStream.ts b/play-dl/YouTube/classes/SeekStream.ts index 4a37f07..c87db9f 100644 --- a/play-dl/YouTube/classes/SeekStream.ts +++ b/play-dl/YouTube/classes/SeekStream.ts @@ -1,7 +1,7 @@ import { IncomingMessage } from 'http'; import { request_stream } from '../../Request'; import { parseAudioFormats, StreamOptions, StreamType } from '../stream'; -import { video_info } from '../utils'; +import { video_stream_info } from '../utils/extractor'; import { Timer } from './LiveStream'; import { WebmSeeker, WebmSeekerState } from './WebmSeeker'; @@ -137,7 +137,7 @@ export class SeekStream { * Retry if we get 404 or 403 Errors. */ private async retry() { - const info = await video_info(this.video_url); + const info = await video_stream_info(this.video_url); const audioFormat = parseAudioFormats(info.format); this.url = audioFormat[this.quality].url; }