From 373116e72c081217617082d9bebeeb54f1287be9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 13 Jan 2022 15:15:47 +0000 Subject: [PATCH] Turn podcast categories into hashtags --- newswire.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/newswire.py b/newswire.py index a17afb3d7..026a95875 100644 --- a/newswire.py +++ b/newswire.py @@ -226,6 +226,10 @@ 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) + # Include tags from podcast categories + if podcast_properties: + post_tags += podcast_properties['categories'] + # combine the tags into a single list for tag in tags: if tag in post_tags: @@ -489,7 +493,7 @@ def xml_podcast_to_dict(xml_item: str, xml_str: str) -> {}: episode_category = episode_category.lower().replace(' ', '') if episode_category not in podcast_categories: if valid_hash_tag(episode_category): - podcast_categories.append(episode_category) + podcast_categories.append('#' + episode_category) continue else: if '>' in episode_category: @@ -500,7 +504,7 @@ def xml_podcast_to_dict(xml_item: str, xml_str: str) -> {}: episode_category.lower().replace(' ', '') if episode_category not in podcast_categories: if valid_hash_tag(episode_category): - podcast_categories.append(episode_category) + podcast_categories.append('#' + episode_category) continue if podcast_episode_image: