summaryrefslogtreecommitdiff
path: root/rss.py
diff options
context:
space:
mode:
Diffstat (limited to 'rss.py')
-rwxr-xr-xrss.py30
1 files changed, 2 insertions, 28 deletions
diff --git a/rss.py b/rss.py
index ccf0cb5..dc16628 100755
--- a/rss.py
+++ b/rss.py
@@ -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>