This commit is contained in:
Marc Beninca 2025-03-18 20:51:27 +01:00
parent 4fd1a87f7a
commit a1584c4f2e
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -9,6 +9,7 @@ from yt_dlp import YoutubeDL
from rwx import Object from rwx import Object
from rwx.log import stream as log from rwx.log import stream as log
TIMESTAMP = "%Y%m%d%H%M%S"
URL = "https://youtube.com" URL = "https://youtube.com"
@ -41,11 +42,13 @@ class Channel(Object):
self.description = d["description"] self.description = d["description"]
self.tags = d["tags"] self.tags = d["tags"]
# TODO thumbnails # TODO thumbnails
self.thumbnails = d["thumbnails"]
# TODO thumbnail from thumbnails
self.uploader_id = d["uploader_id"] self.uploader_id = d["uploader_id"]
self.uploader = d["uploader"] self.uploader = d["uploader"]
# videos # videos
self.videos_ids = [ self.videos = [
entry["id"] Video(entry)
for entry in reversed(d["entries"]) for entry in reversed(d["entries"])
if entry["availability"] != "subscriber_only" if entry["availability"] != "subscriber_only"
] ]
@ -75,15 +78,15 @@ class Video(Object):
:param d: video info :param d: video info
:type d: dict :type d: dict
""" """
self.at = datetime.now().strftime("%Y%m%d%H%M%S")
# info
self.uid = d["id"] self.uid = d["id"]
self.title = d["title"] self.title = d["title"]
self.description_cut = d["description"] self.description_cut = d["description"]
self.duration = int(d["duration"]) self.duration = int(d["duration"])
self.thumbnails = [thumbnail["url"] for thumbnail in d["thumbnails"]]
# TODO thumbnail from thumbnails # TODO thumbnail from thumbnails
def load_extra(self): def load_extra(self):
self.at = datetime.now().strftime(TIMESTAMP)
d = extract_video(self.uid) d = extract_video(self.uid)
# TODO formats # TODO formats
# TODO thumbnail from thumbnails # TODO thumbnail from thumbnails
@ -98,7 +101,7 @@ class Video(Object):
# TODO subtitles # TODO subtitles
self.chapters = d["chapters"] self.chapters = d["chapters"]
self.likes = d["like_count"] self.likes = d["like_count"]
self.timestamp = datetime.fromtimestamp(d["timestamp"]).strftime("%Y%m%d%H%M%S") self.timestamp = datetime.fromtimestamp(d["timestamp"]).strftime(TIMESTAMP)
self.fulltitle = d["fulltitle"] self.fulltitle = d["fulltitle"]