Add /channels HTML page and fix placeholder channel names
Some checks failed
docker-build / build (push) Has been cancelled

- Add /channels route serving a simple HTML page with channel names
  linked to their YouTube pages
- Fix names for UCehAungJpAeC (Wholly Unfocused) and UCiJmdXTb76i
  (Bridges of Meaning Hub) from Elasticsearch data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-20 12:01:45 -04:00
parent 7fdb31bf18
commit bb2850ef98
2 changed files with 49 additions and 2 deletions

View File

@@ -81,7 +81,7 @@ channels:
name: TheCommonToad
url: https://www.youtube.com/channel/UC-QiBn6GsM3JZJAeAQpaGAA/videos
- id: UCiJmdXTb76i8eIPXdJyf8ZQ
name: Channel UCiJmdXTb76i
name: Bridges of Meaning Hub
url: https://www.youtube.com/channel/UCiJmdXTb76i8eIPXdJyf8ZQ/videos
- id: UCM9Z05vuQhMEwsV03u6DrLA
name: Cassidy van der Kamp
@@ -264,7 +264,7 @@ channels:
name: LeviathanForPlay
url: https://www.youtube.com/@LeviathanForPlay/videos
- id: UCehAungJpAeC-F3R5FwvvCQ
name: Channel UCehAungJpAeC
name: Wholly Unfocused
url: https://www.youtube.com/channel/UCehAungJpAeC-F3R5FwvvCQ/videos
- id: UC4YwC5zA9S_2EwthE27Xlew
name: Channel UC4YwC5zA9S

View File

@@ -1309,6 +1309,53 @@ def create_app(config: AppConfig = CONFIG) -> Flask:
body = "\n".join(urls) + ("\n" if urls else "")
return (body, 200, {"Content-Type": "text/plain; charset=utf-8"})
@app.route("/channels")
def channels_page():
try:
entries = load_channel_entries(config.channels_path)
except FileNotFoundError:
return "Channel list not found.", 404
except Exception:
return "Failed to load channel list.", 500
rows = ""
for ch in entries:
name = ch.get("name") or ch.get("handle") or ch.get("id") or "Unknown"
url = ch.get("url", "")
# Link to the channel page, not the /videos tab
channel_url = url.replace("/videos", "") if url.endswith("/videos") else url
name_html = (
f'<a href="{channel_url}" target="_blank" rel="noopener">{name}</a>'
if channel_url
else name
)
rows += f"<tr><td>{name_html}</td></tr>\n"
html = f"""<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Channels - This Little Corner</title>
<style>
body {{ font-family: system-ui, -apple-system, sans-serif; margin: 2rem auto; max-width: 640px; color: #222; }}
h1 {{ font-size: 1.4rem; margin-bottom: 0.25rem; }}
p.sub {{ color: #666; margin-top: 0; font-size: 0.9rem; }}
table {{ width: 100%; border-collapse: collapse; }}
td {{ padding: 0.45rem 0; border-bottom: 1px solid #eee; }}
a {{ color: #1a6fb5; text-decoration: none; }}
a:hover {{ text-decoration: underline; }}
</style>
</head>
<body>
<h1>Channels</h1>
<p class="sub">{len(entries)} channels tracked</p>
<table>
{rows}</table>
</body>
</html>"""
return (html, 200, {"Content-Type": "text/html; charset=utf-8"})
def _rss_target(feed_name: str) -> str:
name = (feed_name or "").strip("/")
if not name: