Mobile nav, channel banners, search channel linking
- Add bottom tab bar (Home/Following/Discover/Downloads/Settings) for mobile - Fetch and display channel banner images on channel pages - Fix ChannelCard: channels without a local DB id now follow+navigate on click Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,6 +82,19 @@ def _normalize_video(info: dict) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def _channel_banner(thumbnails: list | None) -> str | None:
|
||||
if not thumbnails:
|
||||
return None
|
||||
for t in thumbnails:
|
||||
if "banner" in str(t.get("id") or "").lower():
|
||||
return t.get("url")
|
||||
wide = [t for t in thumbnails
|
||||
if t.get("width") and t.get("height") and t["width"] > t["height"] * 3]
|
||||
if wide:
|
||||
return max(wide, key=lambda t: t.get("width") or 0).get("url")
|
||||
return None
|
||||
|
||||
|
||||
def _channel_avatar(thumbnails: list | None) -> str | None:
|
||||
"""Pick the channel avatar from yt-dlp's thumbnails list.
|
||||
|
||||
@@ -109,7 +122,7 @@ def _normalize_channel(info: dict) -> dict:
|
||||
"name": info.get("channel") or info.get("title") or info.get("uploader") or None,
|
||||
"description": info.get("description") or None,
|
||||
"thumbnail_url": _channel_avatar(info.get("thumbnails")),
|
||||
"banner_url": None,
|
||||
"banner_url": _channel_banner(info.get("thumbnails")),
|
||||
"subscriber_count": info.get("channel_follower_count"),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user