wip
This commit is contained in:
parent
4fd1a87f7a
commit
a1584c4f2e
1 changed files with 8 additions and 5 deletions
|
@ -9,6 +9,7 @@ from yt_dlp import YoutubeDL
|
|||
from rwx import Object
|
||||
from rwx.log import stream as log
|
||||
|
||||
TIMESTAMP = "%Y%m%d%H%M%S"
|
||||
URL = "https://youtube.com"
|
||||
|
||||
|
||||
|
@ -41,11 +42,13 @@ class Channel(Object):
|
|||
self.description = d["description"]
|
||||
self.tags = d["tags"]
|
||||
# TODO thumbnails
|
||||
self.thumbnails = d["thumbnails"]
|
||||
# TODO thumbnail from thumbnails
|
||||
self.uploader_id = d["uploader_id"]
|
||||
self.uploader = d["uploader"]
|
||||
# videos
|
||||
self.videos_ids = [
|
||||
entry["id"]
|
||||
self.videos = [
|
||||
Video(entry)
|
||||
for entry in reversed(d["entries"])
|
||||
if entry["availability"] != "subscriber_only"
|
||||
]
|
||||
|
@ -75,15 +78,15 @@ class Video(Object):
|
|||
:param d: video info
|
||||
:type d: dict
|
||||
"""
|
||||
self.at = datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
# info
|
||||
self.uid = d["id"]
|
||||
self.title = d["title"]
|
||||
self.description_cut = d["description"]
|
||||
self.duration = int(d["duration"])
|
||||
self.thumbnails = [thumbnail["url"] for thumbnail in d["thumbnails"]]
|
||||
# TODO thumbnail from thumbnails
|
||||
|
||||
def load_extra(self):
|
||||
self.at = datetime.now().strftime(TIMESTAMP)
|
||||
d = extract_video(self.uid)
|
||||
# TODO formats
|
||||
# TODO thumbnail from thumbnails
|
||||
|
@ -98,7 +101,7 @@ class Video(Object):
|
|||
# TODO subtitles
|
||||
self.chapters = d["chapters"]
|
||||
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"]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue