From 0f5b509c750fd08f511d73eb728926999389defd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 11 Oct 2022 14:30:20 +0530 Subject: [PATCH] Update The Economic Times India Print Edition --- ...theeconomictimes_india_print_edition.recipe | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/recipes/theeconomictimes_india_print_edition.recipe b/recipes/theeconomictimes_india_print_edition.recipe index 0c17c58e55..d1cb6c6575 100644 --- a/recipes/theeconomictimes_india_print_edition.recipe +++ b/recipes/theeconomictimes_india_print_edition.recipe @@ -1,3 +1,4 @@ + ''' economictimes.indiatimes.com ''' @@ -19,13 +20,28 @@ class TheEconomicTimes(BasicNewsRecipe): remove_attributes = ['style', 'height', 'width'] publication_type = 'newspaper' masthead_url = 'https://upload.wikimedia.org/wikipedia/commons/9/98/The_Economic_Times_logo.svg' - cover_url = 'https://www.readwhere.com/read/imageapi/coverforissue/3034969/magazine/600' ignore_duplicate_articles = {'title', 'url'} extra_css = ''' .summary {font-weight:normal; font-size:normal; font-style:italic;} time{font-size:small;} ''' + def get_cover_url(self): + from datetime import date + yr = str(date.today().year) + mn = date.today().strftime('%m') + dy = date.today().strftime('%d') + cover = 'https://asset.harnscloud.com/PublicationData/ET/etbg/'\ + + yr + '/' + mn + '/' + dy + '/Page/' + dy + '_' + mn + '_' + yr + '_001_etbg.jpg' + self.log('cover_url ', cover) + br = BasicNewsRecipe.get_browser(self) + try: + br.open(cover) + except: + self.log("\nCover unavailable") + cover = None + return cover + keep_only_tags = [ dict(name='h1'), classes(