aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/templates
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/templates
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/templates')
-rw-r--r--youtube/templates/comments.html4
-rw-r--r--youtube/templates/common_elements.html4
-rw-r--r--youtube/templates/playlist.html6
-rw-r--r--youtube/templates/watch.html4
4 files changed, 14 insertions, 4 deletions
diff --git a/youtube/templates/comments.html b/youtube/templates/comments.html
index 7bd75e5..4728a0a 100644
--- a/youtube/templates/comments.html
+++ b/youtube/templates/comments.html
@@ -3,13 +3,13 @@
{% macro render_comment(comment, include_avatar, timestamp_links=False) %}
<div class="comment-container">
<div class="comment">
- <a class="author-avatar" href="{{ comment['author_url'] }}" title="{{ comment['author'] }}">
+ <a class="author-avatar" href="{{ comment['author_url'] or '#' }}" title="{{ comment['author'] }}">
{% if include_avatar %}
<img class="author-avatar-img" alt="{{ comment['author'] }}" src="{{ comment['author_avatar'] }}">
{% endif %}
</a>
<address class="author-name">
- <a class="author" href="{{ comment['author_url'] }}" title="{{ comment['author'] }}">{{ comment['author'] }}</a>
+ <a class="author" href="{{ comment['author_url'] or '#' }}" title="{{ comment['author'] }}">{{ comment['author'] }}</a>
</address>
<a class="permalink" href="{{ comment['permalink'] }}" title="permalink">
<span>{{ comment['time_published'] }}</span>
diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html
index bd43761..5b72063 100644
--- a/youtube/templates/common_elements.html
+++ b/youtube/templates/common_elements.html
@@ -20,7 +20,7 @@
{{ info['error'] }}
{% else %}
<div class="item-video {{ info['type'] + '-item' }}">
- <a class="thumbnail-box" href="{{ info['url'] }}" title="{{ info['title'] }}">
+ <a class="thumbnail-box" href="{{ info['url'] or '#' }}" title="{{ info['title'] }}">
<div class="thumbnail {% if info['type'] == 'channel' %} channel {% endif %}">
{% if lazy_load %}
<img class="thumbnail-img lazy" alt="&#x20;" data-src="{{ info['thumbnail'] }}" onerror="thumbnail_fallback(this)">
@@ -35,7 +35,7 @@
{% endif %}
</div>
</a>
- <h4 class="title"><a href="{{ info['url'] }}" title="{{ info['title'] }}">{{ info['title'] }}</a></h4>
+ <h4 class="title"><a href="{{ info['url'] or '#' }}" title="{{ info['title'] }}">{{ info['title'] }}</a></h4>
{% if include_author %}
{% set author_description = info['author'] %}
diff --git a/youtube/templates/playlist.html b/youtube/templates/playlist.html
index 994523e..dc9c37a 100644
--- a/youtube/templates/playlist.html
+++ b/youtube/templates/playlist.html
@@ -10,11 +10,17 @@
<div class="playlist-metadata">
<div class="author">
+ {% if thumbnail %}
<img alt="{{ title }}" src="{{ thumbnail }}">
+ {% endif %}
<h2>{{ title }}</h2>
</div>
<div class="summary">
+ {% if author_url %}
<a class="playlist-author" href="{{ author_url }}">{{ author }}</a>
+ {% else %}
+ <span class="playlist-author">{{ author }}</span>
+ {% endif %}
</div>
<div class="playlist-stats">
<div>{{ video_count|commatize }} videos</div>
diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html
index 5ff31cb..d62884f 100644
--- a/youtube/templates/watch.html
+++ b/youtube/templates/watch.html
@@ -172,7 +172,11 @@
{% else %}
<li>{{ playlist['current_index']+1 }}/{{ playlist['video_count'] }}</li>
{% endif %}
+ {% if playlist['author_url'] %}
<li><a href="{{ playlist['author_url'] }}" title="{{ playlist['author'] }}">{{ playlist['author'] }}</a></li>
+ {% elif playlist['author'] %}
+ <li>{{ playlist['author'] }}</li>
+ {% endif %}
</ul>
</div>
<nav class="playlist-videos">