From 8fc602a35ac768558561db41ae977f53840c97ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8A=88=EB=A6=AC=ED=8A=AC?= <9804cjh@naver.com> Date: Wed, 22 Sep 2021 15:21:44 +0900 Subject: [PATCH 1/2] Fix invalid parameter of fetched_tracks.get --- play-dl/Spotify/classes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/play-dl/Spotify/classes.ts b/play-dl/Spotify/classes.ts index daf49d5..52540a8 100644 --- a/play-dl/Spotify/classes.ts +++ b/play-dl/Spotify/classes.ts @@ -163,7 +163,7 @@ export class SpotifyPlaylist { get total_tracks() { const page_number: number = this.total_pages; - return (page_number - 1) * 100 + (this.fetched_tracks.get(`page${page_number}`) as SpotifyVideo[]).length; + return (page_number - 1) * 100 + (this.fetched_tracks.get(`${page_number}`) as SpotifyVideo[]).length; } toJSON() { @@ -267,7 +267,7 @@ export class SpotifyAlbum { get total_tracks() { const page_number: number = this.total_pages; - return (page_number - 1) * 100 + (this.fetched_tracks.get(`page${page_number}`) as SpotifyVideo[]).length; + return (page_number - 1) * 100 + (this.fetched_tracks.get(`${page_number}`) as SpotifyVideo[]).length; } toJSON() { From a25c0d98909dd9e5d75e124193103f2b1e0b8685 Mon Sep 17 00:00:00 2001 From: Killer069 <65385476+killer069@users.noreply.github.com> Date: Wed, 22 Sep 2021 11:57:54 +0530 Subject: [PATCH 2/2] Removed useless page from YouTube PlayList --- play-dl/YouTube/classes/Playlist.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/play-dl/YouTube/classes/Playlist.ts b/play-dl/YouTube/classes/Playlist.ts index f79c95d..3254c8c 100644 --- a/play-dl/YouTube/classes/Playlist.ts +++ b/play-dl/YouTube/classes/Playlist.ts @@ -44,7 +44,7 @@ export class PlayList { this.thumbnail = data.thumbnail || undefined; this.videos = data.videos || []; this.__count++; - this.fetched_videos.set(`page${this.__count}`, this.videos as Video[]); + this.fetched_videos.set(`${this.__count}`, this.videos as Video[]); this._continuation.api = data.continuation?.api ?? undefined; this._continuation.token = data.continuation?.token ?? undefined; this._continuation.clientVersion = data.continuation?.clientVersion ?? ''; @@ -89,7 +89,7 @@ export class PlayList { if (!contents) return []; const playlist_videos = getPlaylistVideos(contents, limit); - this.fetched_videos.set(`page${this.__count}`, playlist_videos); + this.fetched_videos.set(`${this.__count}`, playlist_videos); this._continuation.token = getContinuationToken(contents); return playlist_videos; } @@ -115,8 +115,8 @@ export class PlayList { page(number: number): Video[] { if (!number) throw new Error('Page number is not provided'); - if (!this.fetched_videos.has(`page${number}`)) throw new Error('Given Page number is invalid'); - return this.fetched_videos.get(`page${number}`) as Video[]; + if (!this.fetched_videos.has(`${number}`)) throw new Error('Given Page number is invalid'); + return this.fetched_videos.get(`${number}`) as Video[]; } get total_pages() { @@ -125,7 +125,7 @@ export class PlayList { get total_videos() { const page_number: number = this.total_pages; - return (page_number - 1) * 100 + (this.fetched_videos.get(`page${page_number}`) as Video[]).length; + return (page_number - 1) * 100 + (this.fetched_videos.get(`${page_number}`) as Video[]).length; } toJSON() {