extract
This commit is contained in:
parent
6a2421922b
commit
9e37e3be95
1 changed files with 18 additions and 13 deletions
|
@ -56,7 +56,14 @@ class Tab(Object, ABC):
|
||||||
log.info(self.object_id)
|
log.info(self.object_id)
|
||||||
self.url = self.get_url()
|
self.url = self.get_url()
|
||||||
log.info(self.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
|
self.url, download=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -100,21 +107,19 @@ class Playlists(Tab):
|
||||||
return f"{Tab.URL_ROOT}/channel/{self.object_id}/playlists"
|
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):
|
class Video(Tab):
|
||||||
def __init__(self, video_id: str) -> None:
|
def __init__(self, video_id: str) -> None:
|
||||||
super().__init__(video_id)
|
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:
|
def download(self) -> None:
|
||||||
Tab.yt_dl(
|
Tab.yt_dl(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue