From 5944fd2458e7ba7e3da11215f8d138682ad7b9c4 Mon Sep 17 00:00:00 2001 From: sherl Date: Sun, 5 Oct 2025 17:22:15 +0200 Subject: [PATCH] feat: support for "trending" playlists (without authors) also introduces a fix for text run parsing (by forcing obj to be a dict) --- ythdd_inv_tl.py | 2 +- ythdd_struct_parser.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ythdd_inv_tl.py b/ythdd_inv_tl.py index 504118c..b99fd60 100644 --- a/ythdd_inv_tl.py +++ b/ythdd_inv_tl.py @@ -904,7 +904,7 @@ def playlists(data, req, only_json: bool = False): # no info about what length can playlists be # settle for a basic sanity check instead # if len(plid) not in (18, 34, 36): - if not plid.startswith("PL"): + if not (plid.startswith("PL") or plid.startswith("OL")): response = {"error": "Only standard playlists are currently supported (no mixes, video-based playlists, etc.)"} if only_json: return response diff --git a/ythdd_struct_parser.py b/ythdd_struct_parser.py index 1b5b265..8f56fca 100644 --- a/ythdd_struct_parser.py +++ b/ythdd_struct_parser.py @@ -471,6 +471,8 @@ def extractTextFromSimpleOrRuns(obj: dict, default: str = "") -> str: # Extracts the text both from "runs" and "simpleText" # with failsafe to default. text = default + if not isinstance(obj, str): + return default if "runs" in obj: text = runsToText(obj["runs"]) elif "simpleText" in obj: