mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Playlist: Support edge case where 'content' in JSON may be erroneously plural
This commit is contained in:
parent
94ecd29e35
commit
9bdfb0a32b
1 changed files with 5 additions and 2 deletions
|
@ -471,9 +471,12 @@ def extract_playlist_videos(initial_data : Hash(String, JSON::Any))
|
||||||
tabs = initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"]
|
tabs = initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"]
|
||||||
tabs_renderer = tabs.as_a.select(&.["tabRenderer"]["selected"]?.try &.as_bool)[0]["tabRenderer"]
|
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
|
# 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]
|
item_renderer = list_renderer.["itemSectionRenderer"]["contents"][0]
|
||||||
contents = item_renderer.["playlistVideoListRenderer"]["contents"].as_a
|
contents = item_renderer.["playlistVideoListRenderer"]["contents"].as_a
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue