From 00b1cbdb1dca8430a671982e4ca33595b3a207f7 Mon Sep 17 00:00:00 2001 From: Laszlo Zeke Date: Sun, 2 Apr 2017 20:17:47 +0200 Subject: [PATCH] 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 --- TwitchRSS/lib/feedformatter.py | 6 +++--- TwitchRSS/twitchrss.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TwitchRSS/lib/feedformatter.py b/TwitchRSS/lib/feedformatter.py index b33be2a..e43db86 100644 --- a/TwitchRSS/lib/feedformatter.py +++ b/TwitchRSS/lib/feedformatter.py @@ -82,7 +82,8 @@ _rss2_channel_mappings = ( (("webMaster",), "webmaster"), (("image",), "image"), (("skipHours",), "skipHours"), - (("skipDays",), "skipDays") + (("skipDays",), "skipDays"), + (("ttl",), "ttl") ) _rss2_item_mappings = ( @@ -92,8 +93,7 @@ _rss2_item_mappings = ( (("guid", "id"), "guid"), (("pubDate", "pubdate", "date", "published", "updated"), "pubDate", lambda(x): _format_datetime("rss2",x)), (("category",), "category"), - (("author",), "author", lambda(x): _rssify_author(x)), - (("ttl",), "ttl") + (("author",), "author", lambda(x): _rssify_author(x)) ) # Atom 1.0 ---------- diff --git a/TwitchRSS/twitchrss.py b/TwitchRSS/twitchrss.py index 341ebc0..0f4fdda 100644 --- a/TwitchRSS/twitchrss.py +++ b/TwitchRSS/twitchrss.py @@ -146,6 +146,7 @@ class RSSVoDServer(webapp2.RequestHandler): feed.feed["link"] = "https://twitchrss.appspot.com/" feed.feed["author"] = "Twitch RSS Gen" feed.feed["description"] = "The RSS Feed of %s's videos on Twitch" % display_name + feed.feed["ttl"] = '10' # Create an item try: @@ -169,7 +170,6 @@ class RSSVoDServer(webapp2.RequestHandler): item["guid"] = vod['_id'] if vod["status"] == "recording": # To show a different news item when recording is over item["guid"] += "_live" - item["ttl"] = '10' feed.items.append(item) except KeyError as e: logging.warning('Issue with json: %s\nException: %s' % (vods_info, e))