Fixed max_age setting failing to filter old items
This change fixes #28 (closed) so max_age
actually filters older articles by using .total_seconds()
instead of .seconds
.
timedelta
stores the difference between two datetime
objects as the number of .days
plus the remaining .seconds
and .microseconds
. This means .seconds
is always less than 24 hours worth of seconds (86400). Consequently, .seconds < max_age
makes no sense when now - publish_date
is longer than one day because the days aren't counted, resulting in false positives with older articles.
.total_seconds()
adds up .days
, .seconds
, and .microseconds
as seconds, so .total_seconds() < max_age
results in the desired behavior and older articles are ignored.