Improve RSS validity

This commit is contained in:
Zed 2019-09-15 11:14:03 +02:00
parent a87e278a68
commit 8912c53f23
2 changed files with 15 additions and 8 deletions

View file

@ -114,7 +114,10 @@ proc getJoinDateFull*(profile: Profile): string =
profile.joinDate.format("h:mm tt - d MMM YYYY")
proc getTime*(tweet: Tweet): string =
tweet.time.format("d/M/yyyy', ' HH:mm:ss")
tweet.time.format("d/M/yyyy', 'HH:mm:ss")
proc getRfc822Time*(tweet: Tweet): string =
tweet.time.format("ddd', 'd MMM yyyy HH:mm:ss 'GMT'")
proc getLink*(tweet: Tweet | Quote): string =
&"/{tweet.profile.username}/status/{tweet.id}"

View file

@ -43,23 +43,27 @@
#let prefs = Prefs(replaceTwitter: hostname)
#result = ""
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:nitter="http://${hostname}" version="2.0">
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<atom:link href="http://${hostname}${profile.username}/rss" rel="self" type="application/rss+xml" />
<atom:link href="https://${hostname}/${profile.username}/rss" rel="self" type="application/rss+xml" />
<title>${profile.fullname} / @${profile.username}</title>
<link>https://${hostname}${profile.username}</link>
<description>Twitter feed for: ${profile.username}. Generated by ${hostname}</description>
<link>https://${hostname}/${profile.username}</link>
<description>Twitter feed for: @${profile.username}. Generated by ${hostname}</description>
<language>en-us</language>
<ttl>40</ttl>
<image>
<url>https://${hostname}${getPicUrl(profile.getUserPic(style="_400x400"))}</url>
<title>${profile.fullname} / @${profile.username}</title>
<link>https://${hostname}/${profile.username}</link>
<url>https://${hostname}${getPicUrl(profile.getUserPic(style="_400x400"))}</url>
<width>128</width>
<height>128</height>
</image>
#for tweet in tweets:
<item>
<title>${getTitle(tweet, prefs)}</title>
<creator> (@${tweet.profile.username})</creator>
<dc:creator>@${tweet.profile.username}</dc:creator>
<description><![CDATA[${renderRssTweet(tweet, prefs).strip(chars={'\n'})}]]></description>
<pubDate>${getTime(tweet)}</pubDate>
<pubDate>${getRfc822Time(tweet)}</pubDate>
<guid>https://${hostname}${getLink(tweet)}</guid>
<link>https://${hostname}${getLink(tweet)}</link>
</item>