From 9bdfb0a32b1d606d1e966ab07d7a05fe56f75643 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sat, 20 Mar 2021 22:45:27 +0000 Subject: [PATCH] Playlist: Support edge case where 'content' in JSON may be erroneously plural --- src/invidious/playlists.cr | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 1ef71a84..508dc760 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -471,9 +471,12 @@ def extract_playlist_videos(initial_data : Hash(String, JSON::Any)) tabs = initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"] tabs_renderer = tabs.as_a.select(&.["tabRenderer"]["selected"]?.try &.as_bool)[0]["tabRenderer"] - if tabs_renderer["contents"]? + # Watch out the two versions, with and without "s" + if tabs_renderer["contents"]? || tabs_renderer["content"]? # Initial playlist data - list_renderer = tabs_renderer.["contents"]["sectionListRenderer"]["contents"][0] + tabs_contents = tabs_renderer.["contents"]? || tabs_renderer.["content"] + + list_renderer = tabs_contents.["sectionListRenderer"]["contents"][0] item_renderer = list_renderer.["itemSectionRenderer"]["contents"][0] contents = item_renderer.["playlistVideoListRenderer"]["contents"].as_a else