This commit is contained in:
Marc Beninca 2025-03-18 16:30:21 +01:00
parent e81cd5b745
commit cc4eb0e686
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -12,6 +12,11 @@ from rwx.log import stream as log
URL = "https://youtube.com"
# ╭─────────╮
# │ classes │
# ╰─────────╯
class Cache(Object):
"""YouTube local cache."""
@ -79,7 +84,7 @@ class Video(Object):
:param d: video info
:type d: dict
"""
self.datetime = datetime.now().strftime("%Y%m%d%H%M%S")
self.at = datetime.now().strftime("%Y%m%d%H%M%S")
self.uid = d["id"]
self.fulltitle = d["fulltitle"]
self.duration = d["duration"]
@ -136,7 +141,7 @@ def download_video(video_id: str | None) -> None:
# ╰─────────╯
def extract(opt: dict[str, Any], url: str) -> dict[str, Any]:
def extract(url: str) -> dict[str, Any]:
"""Return extracted dict.
:rtype: dict
@ -159,7 +164,7 @@ def extract_playlist(playlist_id: str) -> dict:
:type playlist_id: str
:rtype: dict
"""
return extract({}, url_playlist(playlist_id))
return extract(url_playlist(playlist_id))
def extract_playlists(channel_id: str) -> dict:
@ -169,7 +174,7 @@ def extract_playlists(channel_id: str) -> dict:
:type channel_id: str
:rtype: dict
"""
return extract({}, url_playlists(channel_id))
return extract(url_playlists(channel_id))
def extract_video(video_id: str) -> dict:
@ -179,7 +184,7 @@ def extract_video(video_id: str) -> dict:
:type video_id: str
:rtype: dict
"""
return extract({}, url_video(video_id))
return extract(url_video(video_id))
def extract_videos(channel_id: str) -> dict:
@ -189,7 +194,7 @@ def extract_videos(channel_id: str) -> dict:
:type channel_id: str
:rtype: dict
"""
return extract({}, url_videos(channel_id))
return extract(url_videos(channel_id))
# ╭────────╮