diff options
Diffstat (limited to 'rss.py')
-rwxr-xr-x | rss.py | 30 |
1 files changed, 2 insertions, 28 deletions
@@ -1,8 +1,9 @@ #!/usr/bin/env python3 -from dataclasses import dataclass from datetime import datetime +from rss_types import RSSFeed + def _format_date(dt): """convert a datetime into an RFC 822 formatted date @@ -50,39 +51,12 @@ def _format_date(dt): ) -@dataclass -class RSSItem: - title: str - url: str - content: str - date: str - enclosures: list[str] - guid: str - - -@dataclass -class RSSFeed: - title: str - url: str - description: str - content: list[RSSItem] - - def escape(str): str = str.replace("&", "&") return str def buildRSS(feed_data: RSSFeed): - """ - feed_data = { - title, url, description, - content = [{ - title, url, content, date, [enclosures], guid - }] - } - """ - feed = f"""<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> |