update patch PR 3183

This commit is contained in:
Emilien Devos
2022-07-03 16:01:39 +02:00
parent 9427a1cd69
commit 1bd048a72d
+32 -3
View File
@@ -1,7 +1,7 @@
From 2851d993ad0079433ee9028c4f2e7854096ed9f0 Mon Sep 17 00:00:00 2001
From: 11tuvork28 <zofi@xamh.de>
Date: Sun, 3 Jul 2022 14:03:30 +0200
Subject: [PATCH 1/3] updated comment to represent current structure
Subject: [PATCH 1/4] updated comment to represent current structure
---
src/invidious/yt_backend/extractors.cr | 2 +-
@@ -24,7 +24,7 @@ index c4326cab5..b9609eb9c 100644
From 15d2cfba90428f8c1bb3e7ce88599078dc0ae6f0 Mon Sep 17 00:00:00 2001
From: 11tuvork28 <zofi@xamh.de>
Date: Sun, 3 Jul 2022 14:03:42 +0200
Subject: [PATCH 2/3] Fix `Missing hash key: "selected" (KeyError)`
Subject: [PATCH 2/4] Fix `Missing hash key: "selected" (KeyError)`
---
src/invidious/yt_backend/extractors_utils.cr | 2 +-
@@ -47,7 +47,7 @@ index 3d5e57876..f82451607 100644
From a8b72d834231a6b353d7dda31e93b2e4907800fd Mon Sep 17 00:00:00 2001
From: 11tuvork28 <zofi@xamh.de>
Date: Sun, 3 Jul 2022 14:23:34 +0200
Subject: [PATCH 3/3] Fixed community tab
Subject: [PATCH 3/4] Fixed community tab
---
src/invidious/channels/community.cr | 2 +-
@@ -66,3 +66,32 @@ index 4701ecbd6..4c32ea20b 100644
if !body
raise InfoException.new("Could not extract community tab.")
From 864f27ef72b084461e327640f80aa45a8f250b0f Mon Sep 17 00:00:00 2001
From: 11tuvork28 <zofi@xamh.de>
Date: Sun, 3 Jul 2022 14:59:33 +0200
Subject: [PATCH 4/4] switched to extract_selected_tab for the community tab
---
src/invidious/channels/community.cr | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/invidious/channels/community.cr b/src/invidious/channels/community.cr
index 4c32ea20b..aaed9567c 100644
--- a/src/invidious/channels/community.cr
+++ b/src/invidious/channels/community.cr
@@ -13,13 +13,11 @@ def fetch_channel_community(ucid, continuation, locale, format, thin_mode)
if !continuation || continuation.empty?
initial_data = extract_initial_data(response.body)
- body = initial_data["contents"]?.try &.["twoColumnBrowseResultsRenderer"]["tabs"].as_a.select { |tab| tab["tabRenderer"]?.try &.["selected"]?.try &.as_bool == true }[0]?
+ body = extract_selected_tab(initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"])["content"]["sectionListRenderer"]["contents"][0]["itemSectionRenderer"]
if !body
raise InfoException.new("Could not extract community tab.")
end
-
- body = body["tabRenderer"]["content"]["sectionListRenderer"]["contents"][0]["itemSectionRenderer"]
else
continuation = produce_channel_community_continuation(ucid, continuation)