From: Adam Sampson Date: Tue, 30 Oct 2012 11:28:24 +0000 (+0000) Subject: Use updated/published/created dates, rather than modified. X-Git-Tag: v2.14~1 X-Git-Url: http://git.ozo.com/?a=commitdiff_plain;h=67d78c2c137b8121c0a7294ec2f178c4d5ba60ec;p=rawdog%2F.git Use updated/published/created dates, rather than modified. --- diff --git a/NEWS b/NEWS index 126628e..8d1cff8 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,12 @@ one. Add a note to PLUGINS about making sure plugin storage gets saved. +Use updated_parsed instead of the obsolete modified_parsed when +extracting the feed-provided date for an item, and fall back to +published_parsed and then created_parsed if it doesn't exist. +(feedparser currently does fallback automatically, but it's scheduled to +be removed at some point, so it's better for rawdog to do it.) + - rawdog 2.13 Forcibly disable BeautifulSoup support in feedparser, since it returns diff --git a/rawdoglib/rawdog.py b/rawdoglib/rawdog.py index 51e55cc..148adc4 100644 --- a/rawdoglib/rawdog.py +++ b/rawdoglib/rawdog.py @@ -1,5 +1,5 @@ # rawdog: RSS aggregator without delusions of grandeur. -# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Adam Sampson +# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Adam Sampson # # rawdog is free software; you can redistribute and/or modify it # under the terms of that license as published by the Free Software @@ -539,11 +539,15 @@ class Article: self.entry_info = entry_info self.sequence = sequence - modified = entry_info.get("modified_parsed") self.date = None - if modified is not None: + parsed = entry_info.get("updated_parsed") + if parsed is None: + parsed = entry_info.get("published_parsed") + if parsed is None: + parsed = entry_info.get("created_parsed") + if parsed is not None: try: - self.date = calendar.timegm(modified) + self.date = calendar.timegm(parsed) except OverflowError: pass