Use updated/published/created dates, rather than modified.
authorAdam Sampson <ats@offog.org>
Tue, 30 Oct 2012 11:28:24 +0000 (11:28 +0000)
committerAdam Sampson <ats@offog.org>
Tue, 30 Oct 2012 11:28:24 +0000 (11:28 +0000)
NEWS
rawdoglib/rawdog.py

diff --git a/NEWS b/NEWS
index 126628e7a28a9e86bbaa4fdfa9bff3bb46a66c46..8d1cff870e40b6ea02fd2e825680f510f2a1e8dc 100644 (file)
--- 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
index 51e55cc5210bfbf5a248932b7ee9161da6d0db89..148adc48ae90772f52704e20d1837984e8291a21 100644 (file)
@@ -1,5 +1,5 @@
 # rawdog: RSS aggregator without delusions of grandeur.
-# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Adam Sampson <ats@offog.org>
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Adam Sampson <ats@offog.org>
 #
 # 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