mirror of
https://codeberg.org/Ewen/rudibridge.git
synced 2024-11-07 14:42:31 +00:00
fix(backend): RSS validation
This commit is contained in:
parent
6b1d9924be
commit
91881fa177
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<atom:link href="{{ request.url }}" rel="self" type="application/rss+xml"/>
|
||||
<link>{{ request.url }}</link>
|
||||
<description>A feed generated from {{ feed.url }} with Rudibridge</description>
|
||||
<lastBuildDate>{{ build_date.strftime("%a, %d %b %Y %T") }} +0000</lastBuildDate>
|
||||
<lastBuildDate>{{ build_date.strftime("%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
|
||||
{% for item in feed.items %}
|
||||
<item>
|
||||
{% if item.title %}
|
||||
|
|
Loading…
Reference in a new issue