diff options
| author | A Farzat <a@farzat.xyz> | 2025-08-20 18:16:05 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2025-08-20 18:16:05 +0300 |
| commit | c3c6cfedbe5882dc7bb349e4c961f393924b4aef (patch) | |
| tree | ef83987ccec3d80ffa20a7b15de4b2b6974607b9 /data-collection/components/videos.py | |
| parent | ebd5d5b9c0c18d8905a4aafb8faf5f25710b9aee (diff) | |
| download | csca5028-c3c6cfedbe5882dc7bb349e4c961f393924b4aef.tar.gz csca5028-c3c6cfedbe5882dc7bb349e4c961f393924b4aef.zip | |
Make subscriptions storable in the database
Diffstat (limited to 'data-collection/components/videos.py')
| -rw-r--r-- | data-collection/components/videos.py | 14 |
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, + ) |
