diff --git a/server.py b/server.py index 63d01c7..1c3c9ad 100644 --- a/server.py +++ b/server.py @@ -632,6 +632,25 @@ def now_old(): "now/old.html", handshake_scripts=handshake_scripts, now_pages=html ) +@app.route("/now.rss") +def now_rss(): + host = request.scheme + "://" + request.host + print(host) + # Generate RSS feed + now_pages = os.listdir("templates/now") + now_pages = [ + page for page in now_pages if page != "template.html" and page != "old.html" + ] + now_pages.sort(reverse=True) + rss = f'Nathan.Woodburn/{host}See what I\'ve been up toen-us{datetime.datetime.now(tz=datetime.timezone.utc).strftime("%a, %d %b %Y %H:%M:%S %z")}' + for page in now_pages: + link = page.strip(".html") + date = datetime.datetime.strptime(link, "%y_%m_%d") + date = date.strftime("%A, %B %d, %Y") + rss += f'{date}{host}/now/{link}{date}{host}/now/{link}' + rss += "" + return make_response(rss, 200, {"Content-Type": "application/rss+xml"}) + # endregion