From fec82df4516c48e27ef12ed7e48faf7e9590d332 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 18 Mar 2021 23:11:46 +0000 Subject: [PATCH] Fix fetching of large playlist --- src/invidious/playlists.cr | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 0251a69c..feaed6de 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -441,17 +441,8 @@ def fetch_playlist_videos(plid, video_count, offset = 0, locale = nil, continuat offset = initial_data["currentVideoEndpoint"]?.try &.["watchEndpoint"]?.try &.["index"]?.try &.as_i64 || offset end - if video_count > 100 - url = produce_playlist_url(plid, offset) - - response = YT_POOL.client &.get(url) - initial_data = JSON.parse(response.body).as_a.find(&.as_h.["response"]?).try &.as_h - elsif offset > 100 - return [] of PlaylistVideo - else # Extract first page of videos - response = YT_POOL.client &.get("/playlist?list=#{plid}&gl=US&hl=en") - initial_data = extract_initial_data(response.body) - end + response = YT_POOL.client &.get("/playlist?list=#{plid}&gl=US&hl=en") + initial_data = extract_initial_data(response.body) return [] of PlaylistVideo if !initial_data videos = extract_playlist_videos(initial_data)