From af7883f5175a0ace2d0d24ebad244b7989f42568 Mon Sep 17 00:00:00 2001 From: bobbysteel Date: Wed, 22 Nov 2017 11:44:16 +0000 Subject: [PATCH] Fix cover to pull from NYT site --- recipes/nytimes_sub.recipe | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 476a91221b..43dcb5bb4e 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -450,25 +450,16 @@ class NYTimes(BasicNewsRecipe): def get_cover_url(self): from datetime import timedelta, date - cover = 'http://webmedia.newseum.org/newseum-multimedia/dfp/jpg' + \ - str(date.today().day) + '/lg/' + self.cover_tag + '.jpg' + today = date.today() + cover = 'https://static01.nyt.com/images/' \ + + today.strftime('%Y') + '/' + today.strftime('%m') + '/' \ + + today.strftime('%d') + '/nytfrontpage/scan.jpg' + self.log(cover) br = BasicNewsRecipe.get_browser(self) daysback = 1 try: br.open(cover) except: - while daysback < 7: - cover = 'http://webmedia.newseum.org/newseum-multimedia/dfp/jpg' + \ - str((date.today() - timedelta(days=daysback)).day) + \ - '/lg/' + self.cover_tag + '.jpg' - br = BasicNewsRecipe.get_browser(self) - try: - br.open(cover) - except: - daysback = daysback + 1 - continue - break - if daysback == 7: self.log("\nCover unavailable") cover = None return cover