From 9e37e3be95e35c3c1ce545d1b535522d815c95e7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 16 Mar 2025 18:28:40 +0100 Subject: [PATCH] extract --- rwx/sw/yt_dlp/__init__.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) 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(