Fixing ttl tag

The ttl tag should be associated with channel object rather than the
item. See
https://validator.w3.org/feed/docs/rss2.html#ltttlgtSubelementOfLtchannelgt
This commit is contained in:
Laszlo Zeke 2017-04-02 20:17:47 +02:00
parent c69fda0fbc
commit 00b1cbdb1d
2 changed files with 4 additions and 4 deletions

View File

@ -82,7 +82,8 @@ _rss2_channel_mappings = (
(("webMaster",), "webmaster"), (("webMaster",), "webmaster"),
(("image",), "image"), (("image",), "image"),
(("skipHours",), "skipHours"), (("skipHours",), "skipHours"),
(("skipDays",), "skipDays") (("skipDays",), "skipDays"),
(("ttl",), "ttl")
) )
_rss2_item_mappings = ( _rss2_item_mappings = (
@ -92,8 +93,7 @@ _rss2_item_mappings = (
(("guid", "id"), "guid"), (("guid", "id"), "guid"),
(("pubDate", "pubdate", "date", "published", "updated"), "pubDate", lambda(x): _format_datetime("rss2",x)), (("pubDate", "pubdate", "date", "published", "updated"), "pubDate", lambda(x): _format_datetime("rss2",x)),
(("category",), "category"), (("category",), "category"),
(("author",), "author", lambda(x): _rssify_author(x)), (("author",), "author", lambda(x): _rssify_author(x))
(("ttl",), "ttl")
) )
# Atom 1.0 ---------- # Atom 1.0 ----------

View File

@ -146,6 +146,7 @@ class RSSVoDServer(webapp2.RequestHandler):
feed.feed["link"] = "https://twitchrss.appspot.com/" feed.feed["link"] = "https://twitchrss.appspot.com/"
feed.feed["author"] = "Twitch RSS Gen" feed.feed["author"] = "Twitch RSS Gen"
feed.feed["description"] = "The RSS Feed of %s's videos on Twitch" % display_name feed.feed["description"] = "The RSS Feed of %s's videos on Twitch" % display_name
feed.feed["ttl"] = '10'
# Create an item # Create an item
try: try:
@ -169,7 +170,6 @@ class RSSVoDServer(webapp2.RequestHandler):
item["guid"] = vod['_id'] item["guid"] = vod['_id']
if vod["status"] == "recording": # To show a different news item when recording is over if vod["status"] == "recording": # To show a different news item when recording is over
item["guid"] += "_live" item["guid"] += "_live"
item["ttl"] = '10'
feed.items.append(item) feed.items.append(item)
except KeyError as e: except KeyError as e:
logging.warning('Issue with json: %s\nException: %s' % (vods_info, e)) logging.warning('Issue with json: %s\nException: %s' % (vods_info, e))