Implement channel and playlist browsing
BrowsePage accepts pasted or routed channel/playlist URLs: - Channels get Videos / Shorts / Live sub-tabs mapped to the channel's /videos, /shorts and /streams listings, lazily fetched 24 at a time with -I range pagination; channel title and id resolve from a cheap -I 1:1 metadata fetch. Subscribe emits subscribeRequested for the Feed page to wire up. - Playlists get a single grid with Play all (bulk-enqueues into the Watch queue) and a Download button that deep-links the playlist into the Downloads tab. Workers are parented to their pages and fetch errors surface as status text instead of crashing (verified against a channel with no videos tab). fetch_flat_info gains an items="1:1" limiter so metadata probes no longer enumerate whole channels. Verified live: kurzgesagt channel (24 cards, title+id resolved) and a 17-video playlist with Play-all queueing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -160,9 +160,17 @@ class YtdlpClient:
|
||||
"""Full info dict for a single video, including formats[].url."""
|
||||
return self.run_json(["--dump-single-json", url], timeout=timeout)
|
||||
|
||||
def fetch_flat_info(self, url: str, timeout: int = 300) -> Dict[str, Any]:
|
||||
"""Flat info dict (playlist/channel entries without per-video formats)."""
|
||||
return self.run_json(["--dump-single-json", "--flat-playlist", url], timeout=timeout)
|
||||
def fetch_flat_info(self, url: str, timeout: int = 300, items: Optional[str] = None) -> Dict[str, Any]:
|
||||
"""Flat info dict (playlist/channel entries without per-video formats).
|
||||
|
||||
items: optional -I range like "1:1" to limit entries when only the
|
||||
top-level metadata (channel title/id) is needed.
|
||||
"""
|
||||
args = ["--dump-single-json", "--flat-playlist"]
|
||||
if items:
|
||||
args.extend(["-I", items])
|
||||
args.append(url)
|
||||
return self.run_json(args, timeout=timeout)
|
||||
|
||||
def fetch_flat_entries(
|
||||
self, url: str, start: int = 1, end: int = 30, timeout: int = 120, use_cache: bool = True
|
||||
|
||||
Reference in New Issue
Block a user