From c3c6cfedbe5882dc7bb349e4c961f393924b4aef Mon Sep 17 00:00:00 2001 From: A Farzat Date: Wed, 20 Aug 2025 18:16:05 +0300 Subject: Make subscriptions storable in the database --- data-collection/components/videos.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'data-collection/components/videos.py') 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, + ) -- cgit v1.2.3-70-g09d2