diff --git a/recipes/the_wire.recipe b/recipes/the_wire.recipe index 52d4a4c045..7f85e0cec3 100644 --- a/recipes/the_wire.recipe +++ b/recipes/the_wire.recipe @@ -1,4 +1,5 @@ #!/usr/bin/env python +import datetime import json from calibre.web.feeds.news import BasicNewsRecipe @@ -73,6 +74,11 @@ class TheWire(BasicNewsRecipe): continue if not b.get('post_type', '') == 'post': continue + now = datetime.now(datetime.timezone.utc) # Ensure 'now' is offset-aware + post_date = datetime.strptime(b['post_date'], '%Y-%m-%d %H:%M:%S').replace(tzinfo=datetime.timezone.utc) # Make 'post_date' offset-aware + if (now - post_date).days > 1: + self.log('Skipping', title, 'as it is too old') + continue title = b['post_title'] desc = b['post_excerpt'] slg = b['categories'][0]['slug'] + '/' + b['post_name']