mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-05 08:50:29 +01:00
Merge pull request #3183 from 11Tuvork28/fix-selected-key-missing
This commit is contained in:
commit
eba84dcd78
@ -13,13 +13,11 @@ def fetch_channel_community(ucid, continuation, locale, format, thin_mode)
|
|||||||
|
|
||||||
if !continuation || continuation.empty?
|
if !continuation || continuation.empty?
|
||||||
initial_data = extract_initial_data(response.body)
|
initial_data = extract_initial_data(response.body)
|
||||||
body = initial_data["contents"]?.try &.["twoColumnBrowseResultsRenderer"]["tabs"].as_a.select { |tab| tab["tabRenderer"]?.try &.["selected"].as_bool.== true }[0]?
|
body = extract_selected_tab(initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"])["content"]["sectionListRenderer"]["contents"][0]["itemSectionRenderer"]
|
||||||
|
|
||||||
if !body
|
if !body
|
||||||
raise InfoException.new("Could not extract community tab.")
|
raise InfoException.new("Could not extract community tab.")
|
||||||
end
|
end
|
||||||
|
|
||||||
body = body["tabRenderer"]["content"]["sectionListRenderer"]["contents"][0]["itemSectionRenderer"]
|
|
||||||
else
|
else
|
||||||
continuation = produce_channel_community_continuation(ucid, continuation)
|
continuation = produce_channel_community_continuation(ucid, continuation)
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ private module Extractors
|
|||||||
# {"tabRenderer": {
|
# {"tabRenderer": {
|
||||||
# "endpoint": {...}
|
# "endpoint": {...}
|
||||||
# "title": "Playlists",
|
# "title": "Playlists",
|
||||||
# "selected": true,
|
# "selected": true, # Is nil unless tab is selected
|
||||||
# "content": {...},
|
# "content": {...},
|
||||||
# ...
|
# ...
|
||||||
# }}
|
# }}
|
||||||
|
@ -84,7 +84,7 @@ end
|
|||||||
|
|
||||||
def extract_selected_tab(tabs)
|
def extract_selected_tab(tabs)
|
||||||
# Extract the selected tab from the array of tabs Youtube returns
|
# Extract the selected tab from the array of tabs Youtube returns
|
||||||
return selected_target = tabs.as_a.select(&.["tabRenderer"]?.try &.["selected"].as_bool)[0]["tabRenderer"]
|
return selected_target = tabs.as_a.select(&.["tabRenderer"]?.try &.["selected"]?.try &.as_bool)[0]["tabRenderer"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_continuation_token(items : Array(JSON::Any))
|
def fetch_continuation_token(items : Array(JSON::Any))
|
||||||
|
Loading…
Reference in New Issue
Block a user