From 5e5c9f381c214599e16829cd33a1aa18f44f518d Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Mon, 24 Jul 2023 15:34:39 +0530 Subject: [PATCH] Update tagesspiegel.recipe --- recipes/bloomberg-business-week.recipe | 14 +++++++------- recipes/tagesspiegel.recipe | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/recipes/bloomberg-business-week.recipe b/recipes/bloomberg-business-week.recipe index 290cfe4ae9..bb3f7c3c37 100644 --- a/recipes/bloomberg-business-week.recipe +++ b/recipes/bloomberg-business-week.recipe @@ -134,27 +134,27 @@ class Bloomberg(BasicNewsRecipe): cat = subhead = lede = auth = caption = '' if 'primaryCategory' in data and data['primaryCategory'] is not None: - cat = '

' + data['primaryCategory'] + '

' + cat = '

' + data['primaryCategory'] + '

' if len(data['abstract']) != 0 and len(data['abstract']) == 2: - subhead = '

' + data['abstract'][0] + '

' + data['abstract'][1] + '

' + subhead = '

' + data['abstract'][0] + '

' + data['abstract'][1] + '

' else: if 'summary' in data: - subhead = '

' + data['summary'] + '

' + subhead = '

' + data['summary'] + '

' if 'byline' in data and data['byline'] is not None: - auth = '
' + data['byline']\ - + ' | ' + data['publishedAt'][:-14] + '
' + auth = '
' + data['byline']\ + + ' | ' + data['publishedAt'][:-14] + '
' if 'ledeImageUrl' in data and data['ledeImageUrl'] is not None: lede = '

'.format(data['ledeImageUrl']) if 'ledeDescription' in data and data['ledeDescription'] is not None: - caption = '' + data['ledeDescription'] + '' + caption = '' + data['ledeDescription'] + '' else: if 'lede' in data and data['lede'] is not None: if 'alt' in data['lede'] and data['lede']['alt'] is not None: - caption = '' + data['lede']['alt'] + '' + caption = '' + data['lede']['alt'] + '' if m: time.sleep(3) diff --git a/recipes/tagesspiegel.recipe b/recipes/tagesspiegel.recipe index 004799f8d7..ee0e562c71 100644 --- a/recipes/tagesspiegel.recipe +++ b/recipes/tagesspiegel.recipe @@ -26,8 +26,22 @@ class TagesspiegelRss(BasicNewsRecipe): ignore_duplicate_articles = {'title', 'url'} remove_empty_feeds = True + def get_browser(self): + return BasicNewsRecipe.get_browser(self, verify_ssl_certificates=False) + + def get_cover_url(self): + from datetime import date + cover = 'https://img.kiosko.net/' + date.today().strftime('%Y/%m/%d') + '/de/tagesspiegel.750.jpg' + return cover + keep_only_tags = [ - classes('ts-lead ts-article-body ts-intro ts-title ts-authors') + dict(name = 'header', attrs={'class':'Bo'}), + dict(name = 'div', attrs={'id':'story-elements'}) + ] + + remove_tags = [ + dict(name = 'aside'), + classes('iqd_mainAd Bs') ] feeds = [ @@ -42,5 +56,3 @@ class TagesspiegelRss(BasicNewsRecipe): (u'Wissen', u'http://www.tagesspiegel.de/contentexport/feed/wissen') ] - def get_masthead_url(self): - return 'http://www.tagesspiegel.de/images/tsp_logo/3114/6.png'