diff --git a/api/api/feed.py b/api/api/feed.py index f1deead..c8f99d7 100644 --- a/api/api/feed.py +++ b/api/api/feed.py @@ -59,7 +59,7 @@ def parse_page(): response.headers["Content-Type"] = "application/json" return response else: - rss_xml = render_template("rss.xml", feed=feed, build_date=datetime.now()) + rss_xml = render_template("rss.xml", feed=feed, build_date=datetime.now().astimezone()) response = make_response(rss_xml) response.headers["Content-Type"] = "application/rss+xml" return response diff --git a/api/api/scraper.py b/api/api/scraper.py index 55e9893..0a1a1cf 100644 --- a/api/api/scraper.py +++ b/api/api/scraper.py @@ -12,7 +12,7 @@ class FeedItem: self.link = link self.author = author if item_datetime: - self.item_datetime = item_datetime.isoformat() + self.item_datetime = item_datetime.strftime("%a, %d %b %Y %H:%M:%S %z") else: self.item_datetime = None @@ -74,7 +74,7 @@ def scrape(request, args): title_class = {"class": args.get("titleClass")} title = article.find(args.get("title"), title_class) if title: - title = title.get_text() + title = title.get_text().strip() content_tag = "p" content_class = {} @@ -121,7 +121,7 @@ def scrape(request, args): author=author ) - if item.title is not None: + if item.title is not None and item.title != "": feed.items.append(item) # Sort by datetime if any diff --git a/api/api/templates/rss.xml b/api/api/templates/rss.xml index 964b83a..a1d2971 100644 --- a/api/api/templates/rss.xml +++ b/api/api/templates/rss.xml @@ -5,7 +5,7 @@ {{ request.url }} A feed generated from {{ feed.url }} with Rudibridge - {{ build_date.strftime("%a, %d %b %Y %T") }} +0000 + {{ build_date.strftime("%a, %d %b %Y %H:%M:%S %z") }} {% for item in feed.items %} {% if item.title %}