diff --git a/recipes/times_online.recipe b/recipes/times_online.recipe index 32d1101db6..3d4dee2583 100644 --- a/recipes/times_online.recipe +++ b/recipes/times_online.recipe @@ -45,6 +45,22 @@ class TimesOnline(BasicNewsRecipe): 'comment': description, 'tags': category, 'publisher': publisher, 'language': language } + def get_cover_url(self): + from datetime import date + cover = 'http://img.kiosko.net/' + str(date.today().year) + '/' + date.today().strftime('%m') + '/' + date.today().strftime('%d') + '/uk/the_times.750.jpg' + br = BasicNewsRecipe.get_browser(self) + try: + br.open(cover) + except: + index = 'http://en.kiosko.net/uk/np/the_times.html' + soup = self.index_to_soup(index) + for image in soup.findAll('img', src=True): + if image['src'].endswith('750.jpg'): + return image['src'] + self.log("\nCover unavailable") + cover = None + return cover + def get_browser(self): br = BasicNewsRecipe.get_browser(self) br.open('http://www.thetimes.co.uk/')