diff --git a/rwx/sw/yt_dlp/__init__.py b/rwx/sw/yt_dlp/__init__.py index b949bfc..f8db074 100644 --- a/rwx/sw/yt_dlp/__init__.py +++ b/rwx/sw/yt_dlp/__init__.py @@ -56,7 +56,14 @@ class Tab(Object, ABC): log.info(self.object_id) self.url = self.get_url() log.info(self.url) - self.info = Tab.yt_dl(self.get_options()).extract_info( + + def extract(self) -> dict: + """Return extracted dict. + + :rtype: dict + """ + yt_dl = Tab.yt_dl(self.get_options()) + return yt_dl.extract_info( self.url, download=False ) @@ -100,21 +107,19 @@ class Playlists(Tab): return f"{Tab.URL_ROOT}/channel/{self.object_id}/playlists" -# id -# title -# formats -# thumbnails -# thumbnail -# description -# -# duration -# view_count -# categories -# tags -# fulltitle class Video(Tab): def __init__(self, video_id: str) -> None: super().__init__(video_id) + info = self.extract() + self.title = info["title"] + self.fulltitle = info["fulltitle"] + self.duration = info["duration"] + self.categories = info["categories"] + self.tags = info["tags"] + self.description = info["description"] + # TODO formats + # TODO thumbnails + # TODO thumbnail def download(self) -> None: Tab.yt_dl(