formats
This commit is contained in:
parent
b7e4add332
commit
7ea1f10c89
1 changed files with 27 additions and 2 deletions
|
@ -65,6 +65,32 @@ class Channel(Object):
|
|||
|
||||
|
||||
# TODO Format
|
||||
class Format(Object):
|
||||
"""YouTube format."""
|
||||
|
||||
def __init__(self, d: dict) -> None:
|
||||
"""Set format info.
|
||||
|
||||
:param d: format info
|
||||
:type d: dict
|
||||
"""
|
||||
self.asr = d["asr"]
|
||||
self.filesize = int(d["filesize"])
|
||||
self.format_id = d["format_id"]
|
||||
self.format_note = d["format_id"]
|
||||
self.fps = d["fps"]
|
||||
self.height = int(d["height"])
|
||||
self.quality = int(d["quality"])
|
||||
self.width = int(d["width"])
|
||||
self.language = d["language"]
|
||||
self.ext = d["ext"]
|
||||
self.vcodec = d["vcodec"]
|
||||
self.acodec = d["acodec"]
|
||||
self.dynamic_range = d["dynamic_range"]
|
||||
self.video_ext = d["video_ext"]
|
||||
self.audio_ext = d["audio_ext"]
|
||||
self.abr = d["abr"]
|
||||
self.vbr = d["vbr"]
|
||||
|
||||
|
||||
# TODO Playlist/extra
|
||||
|
@ -102,8 +128,7 @@ class Video(Object):
|
|||
def load_extra(self):
|
||||
self.at = datetime.now().strftime(TIMESTAMP)
|
||||
d = extract_video(self.uid)
|
||||
# TODO formats
|
||||
self.formats = d["formats"]
|
||||
self.formats = [Format(format) for format in d["formats"]]
|
||||
thumbnail = d["thumbnails"][-1]["url"]
|
||||
# TODO compare existing thumbnail
|
||||
self.description = d["description"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue