From nobody Sat Feb 6 19:21:48 2021 Authentication-Results: mail-b.sr.ht; dkim=none Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id E5EB511F00D for <~cadence/tube-devel@lists.sr.ht>; Sat, 6 Feb 2021 19:21:47 +0000 (UTC) From: ~lomanic Date: Sat, 06 Feb 2021 20:08:25 +0100 Subject: [PATCH Second] Fix stacktrace on auto-generated "X - Topic" channels without Videos tab Message-ID: <161263930770.15985.8336044797103459040-0@git.sr.ht> X-Mailer: git.sr.ht Reply-to: ~lomanic To: ~cadence/tube-devel@lists.sr.ht Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: Lomanic 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): =20 latest_videos =3D [] tabs =3D yt_initial_data["contents"]["twoColumnBrowseResultsRenderer"]["ta= bs"] - videos_tab =3D next(tab["tabRenderer"] for tab in tabs if tab["tabRenderer= "]["title"] =3D=3D "Videos") + videos_tab =3D next((tab["tabRenderer"] for tab in tabs if tab["tabRendere= r"]["title"] =3D=3D "Videos"), {"content": {"sectionListRenderer": {"contents= ": [{"itemSectionRenderer": {"contents": [""]}}]}}}) tab_parts =3D videos_tab["content"]["sectionListRenderer"]["contents"][0][= "itemSectionRenderer"]["contents"][0] =20 # check that the channel actually has videos - this may be replaced --=20 2.26.2