@@ -39,12 +39,6 @@ def rss_item(title: str | None = None,
39
39
item .append (ET .Element ("link" ))
40
40
item [- 1 ].text = link
41
41
42
- # Make GUID link itself
43
- # https://validator.w3.org/feed/docs/warning/MissingGuid.html
44
- # https://validator.w3.org/feed/docs/error/InvalidHttpGUID.html
45
- item .append (ET .Element ("guid" ))
46
- item [- 1 ].text = link
47
-
48
42
# Format dates in RFC-822 date-time
49
43
# https://validator.w3.org/feed/docs/error/InvalidRFC2822Date.html
50
44
if pubDate is not None :
@@ -62,6 +56,15 @@ def rss_item(title: str | None = None,
62
56
63
57
item [- 1 ].text = fmt_date .strftime ("%a, %d %b %Y 09:00:00 EST" )
64
58
59
+ # Make GUID link a mix of the date and description
60
+ # https://validator.w3.org/feed/docs/warning/MissingGuid.html
61
+ # https://validator.w3.org/feed/docs/error/InvalidHttpGUID.html
62
+ item .append (ET .Element ("guid" , {"isPermaLink" : "false" }))
63
+ if pubDate is not None :
64
+ item [- 1 ].text = f"{ pubDate } { ' ' .join (description .split (' ' )[:5 ])} "
65
+ else :
66
+ item [- 1 ].text = f"{ ' ' .join (description .split (' ' )[:5 ])} "
67
+
65
68
return item
66
69
67
70
@@ -92,22 +95,27 @@ def rss_item(title: str | None = None,
92
95
quote = email .get ("quote" )
93
96
94
97
if bonus is not None :
95
- channel .append (
96
- rss_item (title = "Bonus" , description = bonus , pubDate = date ))
98
+ channel .append (rss_item (
99
+ title = "Bonus" ,
100
+ description = bonus ,
101
+ pubDate = date
102
+ ))
97
103
98
104
if quote is not None :
99
105
quote_author = email .get ("quote_author" )
100
106
101
107
if quote_author is not None :
102
108
quote += " - " + quote_author
103
109
104
- channel .append (
105
- rss_item (title = "Quote" , description = quote , pubDate = date ))
110
+ channel .append (rss_item (
111
+ title = "Quote" ,
112
+ description = quote ,
113
+ pubDate = date
114
+ ))
106
115
107
116
json_links = email .get ("links" )
108
117
109
118
for json_link in json_links :
110
-
111
119
channel .append (rss_item (
112
120
description = json_link .get ("description" ),
113
121
link = json_link .get ("link" ),
0 commit comments