~cadence/tube-devel

Second: Fix stacktrace on auto-generated "X - Topic" channels without Videos tab v1 SUPERSEDED

~lomanic
~lomanic: 1
 Fix stacktrace on auto-generated "X - Topic" channels without Videos tab

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~cadence/tube-devel/patches/20089/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH Second] Fix stacktrace on auto-generated "X - Topic" channels without Videos tab Export this patch

~lomanic
From: Lomanic <lomanic@hotmail.fr>

See https://second.cadence.moe/api/v1/channels/UCr-iHMODX8D4a6MVQ_RtdQg as an example
---
 extractors/channel.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extractors/channel.py b/extractors/channel.py
index 787a2ec..bb84cc3 100644
--- a/extractors/channel.py
+++ b/extractors/channel.py
@@ -51,7 +51,7 @@ def extract_channel(ucid):

		latest_videos = []
		tabs = yt_initial_data["contents"]["twoColumnBrowseResultsRenderer"]["tabs"]
		videos_tab = next(tab["tabRenderer"] for tab in tabs if tab["tabRenderer"]["title"] == "Videos")
		videos_tab = next((tab["tabRenderer"] for tab in tabs if tab["tabRenderer"]["title"] == "Videos"), {"content": {"sectionListRenderer": {"contents": [{"itemSectionRenderer": {"contents": [""]}}]}}})
		tab_parts = videos_tab["content"]["sectionListRenderer"]["contents"][0]["itemSectionRenderer"]["contents"][0]

		# check that the channel actually has videos - this may be replaced
-- 
2.26.2
Hardcoding a JSON object in here looked like code smell, so I fixed
the core issue using different code in commit
c8b46999222cad3ffb76862474d1e127125ffac6. Thanks for bringing it to my
attention, though!