mirror of
https://codeberg.org/Ewen/rudibridge.git
synced 2024-12-22 11:12:32 +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"
|
response.headers["Content-Type"] = "application/json"
|
||||||
return response
|
return response
|
||||||
else:
|
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 = make_response(rss_xml)
|
||||||
response.headers["Content-Type"] = "application/rss+xml"
|
response.headers["Content-Type"] = "application/rss+xml"
|
||||||
return response
|
return response
|
||||||
|
|
|
@ -12,7 +12,7 @@ class FeedItem:
|
||||||
self.link = link
|
self.link = link
|
||||||
self.author = author
|
self.author = author
|
||||||
if item_datetime:
|
if item_datetime:
|
||||||
self.item_datetime = item_datetime.isoformat()
|
self.item_datetime = item_datetime.strftime("%a, %d %b %Y %H:%M:%S %z")
|
||||||
else:
|
else:
|
||||||
self.item_datetime = None
|
self.item_datetime = None
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ def scrape(request, args):
|
||||||
title_class = {"class": args.get("titleClass")}
|
title_class = {"class": args.get("titleClass")}
|
||||||
title = article.find(args.get("title"), title_class)
|
title = article.find(args.get("title"), title_class)
|
||||||
if title:
|
if title:
|
||||||
title = title.get_text()
|
title = title.get_text().strip()
|
||||||
|
|
||||||
content_tag = "p"
|
content_tag = "p"
|
||||||
content_class = {}
|
content_class = {}
|
||||||
|
@ -121,7 +121,7 @@ def scrape(request, args):
|
||||||
author=author
|
author=author
|
||||||
)
|
)
|
||||||
|
|
||||||
if item.title is not None:
|
if item.title is not None and item.title != "":
|
||||||
feed.items.append(item)
|
feed.items.append(item)
|
||||||
|
|
||||||
# Sort by datetime if any
|
# Sort by datetime if any
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<atom:link href="{{ request.url }}" rel="self" type="application/rss+xml"/>
|
<atom:link href="{{ request.url }}" rel="self" type="application/rss+xml"/>
|
||||||
<link>{{ request.url }}</link>
|
<link>{{ request.url }}</link>
|
||||||
<description>A feed generated from {{ feed.url }} with Rudibridge</description>
|
<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 %}
|
{% for item in feed.items %}
|
||||||
<item>
|
<item>
|
||||||
{% if item.title %}
|
{% if item.title %}
|
||||||
|
|
Loading…
Reference in a new issue