From 3ae4cea5a8612676e372c89db03e6b021caf3d40 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Tue, 4 Jan 2022 17:49:42 +0530 Subject: [PATCH] music property issue fixed --- play-dl/YouTube/classes/SeekStream.ts | 2 +- play-dl/YouTube/utils/extractor.ts | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/play-dl/YouTube/classes/SeekStream.ts b/play-dl/YouTube/classes/SeekStream.ts index ecae47b..423d8af 100644 --- a/play-dl/YouTube/classes/SeekStream.ts +++ b/play-dl/YouTube/classes/SeekStream.ts @@ -131,7 +131,7 @@ export class SeekStream { this.timer.reuse(); return this.seek(sec); } - const bytes = this.stream.seek(parseFloat(sec.toFixed(2))); + const bytes = this.stream.seek(sec); if (bytes instanceof Error) { this.stream.emit('error', bytes); this.bytes_count = 0; diff --git a/play-dl/YouTube/utils/extractor.ts b/play-dl/YouTube/utils/extractor.ts index 439fcfe..3648b31 100644 --- a/play-dl/YouTube/utils/extractor.ts +++ b/play-dl/YouTube/utils/extractor.ts @@ -205,20 +205,17 @@ export async function video_basic_info(url: string, options: InfoOptions = {}): ?.metadataRowContainer?.metadataRowContainerRenderer?.rows; const music: any[] = []; if (musicInfo) { - let incompleteInfo: any = {}; musicInfo.forEach((x: any) => { if (!x.metadataRowRenderer) return; if (x.metadataRowRenderer.title.simpleText.toLowerCase() === 'song') { - music.push(incompleteInfo); - incompleteInfo = {}; - incompleteInfo.song = + music.push({}); + music[music.length - 1].song = x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text; } else - incompleteInfo[x.metadataRowRenderer.title.simpleText.toLowerCase()] = + music[music.length - 1][x.metadataRowRenderer.title.simpleText.toLowerCase()] = x.metadataRowRenderer.contents[0].simpleText ?? x.metadataRowRenderer.contents[0]?.runs?.[0]?.text; }); } - music.shift(); const video_details = new YouTubeVideo({ id: vid.videoId, title: vid.title,