From 838868e81127b7254933e626d07c623384e6d386 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 13 Jan 2022 23:06:04 +0000 Subject: [PATCH] Check that properties exist --- newswire.py | 8 ++++---- webapp_podcast.py | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/newswire.py b/newswire.py index f561ef53c..425220c5b 100644 --- a/newswire.py +++ b/newswire.py @@ -226,12 +226,12 @@ def _add_newswire_dict_entry(base_dir: str, domain: str, # extract hashtags from the text of the feed post post_tags = get_newswire_tags(all_text, max_tags) - if podcast_properties.get('explicit'): - if '#NSFW' not in post_tags: - post_tags.append('#NSFW') - # Include tags from podcast categories if podcast_properties: + if podcast_properties.get('explicit'): + if '#NSFW' not in post_tags: + post_tags.append('#NSFW') + post_tags += podcast_properties['categories'] # combine the tags into a single list diff --git a/webapp_podcast.py b/webapp_podcast.py index 1f30c36d2..b4d3ae48e 100644 --- a/webapp_podcast.py +++ b/webapp_podcast.py @@ -23,6 +23,8 @@ from webapp_utils import html_keyboard_navigation def _html_podcast_performers(podcast_properties: {}) -> str: """Returns html for performers of a podcast """ + if not podcast_properties: + return '' if not podcast_properties.get('persons'): return '' @@ -72,6 +74,8 @@ def _html_podcast_soundbites(link_url: str, extension: str, translate: {}) -> str: """Returns html for podcast soundbites """ + if not podcast_properties: + return '' if not podcast_properties.get('soundbites'): return ''