summaryrefslogtreecommitdiff
path: root/data-collection/components/videos.py
diff options
context:
space:
mode:
Diffstat (limited to 'data-collection/components/videos.py')
-rw-r--r--data-collection/components/videos.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/data-collection/components/videos.py b/data-collection/components/videos.py
index 71937b2..32dc1da 100644
--- a/data-collection/components/videos.py
+++ b/data-collection/components/videos.py
@@ -1,4 +1,4 @@
-from typing import NamedTuple
+from typing import NamedTuple, Any, Self
from datetime import datetime
class VideoTuple(NamedTuple):
@@ -9,3 +9,15 @@ class VideoTuple(NamedTuple):
updated: datetime
thumbnail: str
summary: str
+
+ @classmethod
+ def from_rss_entry(cls, entry: Any) -> Self:
+ return cls(
+ id = entry.id,
+ link = entry.link,
+ title = entry.title,
+ published = datetime.fromisoformat(entry.published),
+ updated = datetime.fromisoformat(entry.updated),
+ thumbnail = entry.media_thumbnail[0]["url"],
+ summary = entry.summary,
+ )