aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/playlist.py
diff options
context:
space:
mode:
authorAstounds <kirito@disroot.org>2026-03-27 21:23:03 -0500
committerAstounds <kirito@disroot.org>2026-03-27 21:23:03 -0500
commite03f40d72801b8954cd378aaf0e595ccb29f8091 (patch)
tree7ada367f2b275d53b80503630f121a4d0464f9bd /youtube/playlist.py
parent22c72aa842efa6d1dca3bb95eeb47122537ce12a (diff)
downloadyt-local-e03f40d72801b8954cd378aaf0e595ccb29f8091.tar.lz
yt-local-e03f40d72801b8954cd378aaf0e595ccb29f8091.tar.xz
yt-local-e03f40d72801b8954cd378aaf0e595ccb29f8091.zip
fix error handling, null URLs in templates, and Radio playlist support
- Global error handler: friendly messages for 429, 502, 403, 400 instead of raw tracebacks. Filter FetchError from Flask logger. - Fix None URLs in templates: protect href/src in common_elements, playlist, watch, and comments templates against None values. - Radio playlists (RD...): redirect /playlist?list=RD... to /watch?v=...&list=RD... since YouTube only supports them in player. - Wrap player client fallbacks (ios, tv_embedded) in try/catch so a failed fallback doesn't crash the whole page.
Diffstat (limited to 'youtube/playlist.py')
-rw-r--r--youtube/playlist.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/youtube/playlist.py b/youtube/playlist.py
index bedf2d2..c7e0410 100644
--- a/youtube/playlist.py
+++ b/youtube/playlist.py
@@ -78,6 +78,15 @@ def get_playlist_page():
abort(400)
playlist_id = request.args.get('list')
+
+ # Radio/Mix playlists (RD...) only work as watch page, not playlist page
+ if playlist_id.startswith('RD'):
+ first_video_id = playlist_id[2:] # video ID after 'RD' prefix
+ return flask.redirect(
+ util.URL_ORIGIN + '/watch?v=' + first_video_id + '&list=' + playlist_id,
+ 302
+ )
+
page = request.args.get('page', '1')
if page == '1':