From 69bcc9822c82ee6d726c98deafbdd0a20527a55a Mon Sep 17 00:00:00 2001 From: A Farzat Date: Thu, 21 Aug 2025 09:41:56 +0300 Subject: Move components to root directory Some components might be shared with other applications such as the data analyser later on. --- components/videos.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 components/videos.py (limited to 'components/videos.py') diff --git a/components/videos.py b/components/videos.py new file mode 100644 index 0000000..5b2d644 --- /dev/null +++ b/components/videos.py @@ -0,0 +1,27 @@ +from typing import NamedTuple, Any, Self +from datetime import datetime + +class VideoTuple(NamedTuple): + id: str + link: str + title: str + author: str + author_channel: str + published: datetime + 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, + author = entry.author_detail.name, + author_channel = entry.author_detail.href, + 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