feat: support for "trending" playlists (without authors)
also introduces a fix for text run parsing (by forcing obj to be a dict)
This commit is contained in:
@@ -904,7 +904,7 @@ def playlists(data, req, only_json: bool = False):
|
|||||||
# no info about what length can playlists be
|
# no info about what length can playlists be
|
||||||
# settle for a basic sanity check instead
|
# settle for a basic sanity check instead
|
||||||
# if len(plid) not in (18, 34, 36):
|
# 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.)"}
|
response = {"error": "Only standard playlists are currently supported (no mixes, video-based playlists, etc.)"}
|
||||||
if only_json:
|
if only_json:
|
||||||
return response
|
return response
|
||||||
|
|||||||
@@ -471,6 +471,8 @@ def extractTextFromSimpleOrRuns(obj: dict, default: str = "") -> str:
|
|||||||
# Extracts the text both from "runs" and "simpleText"
|
# Extracts the text both from "runs" and "simpleText"
|
||||||
# with failsafe to default.
|
# with failsafe to default.
|
||||||
text = default
|
text = default
|
||||||
|
if not isinstance(obj, str):
|
||||||
|
return default
|
||||||
if "runs" in obj:
|
if "runs" in obj:
|
||||||
text = runsToText(obj["runs"])
|
text = runsToText(obj["runs"])
|
||||||
elif "simpleText" in obj:
|
elif "simpleText" in obj:
|
||||||
|
|||||||
Reference in New Issue
Block a user