Improve typing

This commit is contained in:
Ivan Habunek 2024-04-24 08:11:33 +02:00
parent 6ed98fa4ef
commit 7845cf6f72
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
2 changed files with 5 additions and 4 deletions

View File

@ -7,6 +7,7 @@ from twitchdl import twitch, utils
from twitchdl.commands.download import get_video_placeholders
from twitchdl.exceptions import ConsoleError
from twitchdl.output import bold, print_clip, print_json, print_log, print_table, print_video
from twitchdl.playlists import parse_playlists
from twitchdl.twitch import Chapter, Clip, Video
@ -50,13 +51,13 @@ def info(id: str, *, json: bool = False):
raise ConsoleError(f"Invalid input: {id}")
def video_info(video: Video, playlists, chapters: List[Chapter]):
def video_info(video: Video, playlists: str, chapters: List[Chapter]):
click.echo()
print_video(video)
click.echo("Playlists:")
for p in m3u8.loads(playlists).playlists:
click.echo(f"{bold(p.stream_info.video)} {p.uri}")
for p in parse_playlists(playlists):
click.echo(f"{bold(p.name)} {p.url}")
if chapters:
click.echo()

View File

@ -29,7 +29,7 @@ class Vod:
"""Segment duration in seconds"""
def parse_playlists(playlists_m3u8: str):
def parse_playlists(playlists_m3u8: str) -> List[Playlist]:
def _parse(source: str) -> Generator[Playlist, None, None]:
document = load_m3u8(source)