mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Improve typing
This commit is contained in:
@ -7,6 +7,7 @@ from twitchdl import twitch, utils
|
|||||||
from twitchdl.commands.download import get_video_placeholders
|
from twitchdl.commands.download import get_video_placeholders
|
||||||
from twitchdl.exceptions import ConsoleError
|
from twitchdl.exceptions import ConsoleError
|
||||||
from twitchdl.output import bold, print_clip, print_json, print_log, print_table, print_video
|
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
|
from twitchdl.twitch import Chapter, Clip, Video
|
||||||
|
|
||||||
|
|
||||||
@ -50,13 +51,13 @@ def info(id: str, *, json: bool = False):
|
|||||||
raise ConsoleError(f"Invalid input: {id}")
|
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()
|
click.echo()
|
||||||
print_video(video)
|
print_video(video)
|
||||||
|
|
||||||
click.echo("Playlists:")
|
click.echo("Playlists:")
|
||||||
for p in m3u8.loads(playlists).playlists:
|
for p in parse_playlists(playlists):
|
||||||
click.echo(f"{bold(p.stream_info.video)} {p.uri}")
|
click.echo(f"{bold(p.name)} {p.url}")
|
||||||
|
|
||||||
if chapters:
|
if chapters:
|
||||||
click.echo()
|
click.echo()
|
||||||
|
@ -29,7 +29,7 @@ class Vod:
|
|||||||
"""Segment duration in seconds"""
|
"""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]:
|
def _parse(source: str) -> Generator[Playlist, None, None]:
|
||||||
document = load_m3u8(source)
|
document = load_m3u8(source)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user