mirror of https://gitlab.com/bashrc2/epicyon
Handle multiple categories per podcast item
parent
1587ec0404
commit
41ff8954d7
50
newswire.py
50
newswire.py
|
@ -397,28 +397,36 @@ def _get_podcast_categories(xml_item: str, xml_str: str) -> str:
|
||||||
continue
|
continue
|
||||||
item_str = xml_str
|
item_str = xml_str
|
||||||
|
|
||||||
episode_category = item_str.split(category_tag)[1]
|
category_list = item_str.split(category_tag)
|
||||||
if 'text="' in episode_category:
|
first_category = True
|
||||||
episode_category = episode_category.split('text="')[1]
|
for category_item in category_list:
|
||||||
if '"' in episode_category:
|
if first_category:
|
||||||
episode_category = episode_category.split('"')[0]
|
first_category = False
|
||||||
episode_category = episode_category.lower().replace(' ', '')
|
continue
|
||||||
episode_category = episode_category.replace('#', '')
|
|
||||||
if episode_category not in podcast_categories:
|
|
||||||
if valid_hash_tag(episode_category):
|
|
||||||
podcast_categories.append('#' + episode_category)
|
|
||||||
continue
|
|
||||||
|
|
||||||
if '>' in episode_category:
|
episode_category = category_item
|
||||||
episode_category = episode_category.split('>')[1]
|
if 'text="' in episode_category:
|
||||||
if '<' in episode_category:
|
episode_category = episode_category.split('text="')[1]
|
||||||
episode_category = episode_category.split('<')[0]
|
if '"' in episode_category:
|
||||||
episode_category = \
|
episode_category = episode_category.split('"')[0]
|
||||||
episode_category.lower().replace(' ', '')
|
episode_category = \
|
||||||
episode_category = episode_category.replace('#', '')
|
episode_category.lower().replace(' ', '')
|
||||||
if episode_category not in podcast_categories:
|
episode_category = episode_category.replace('#', '')
|
||||||
if valid_hash_tag(episode_category):
|
if episode_category not in podcast_categories:
|
||||||
podcast_categories.append('#' + episode_category)
|
if valid_hash_tag(episode_category):
|
||||||
|
podcast_categories.append('#' + episode_category)
|
||||||
|
continue
|
||||||
|
|
||||||
|
if '>' in episode_category:
|
||||||
|
episode_category = episode_category.split('>')[1]
|
||||||
|
if '<' in episode_category:
|
||||||
|
episode_category = episode_category.split('<')[0]
|
||||||
|
episode_category = \
|
||||||
|
episode_category.lower().replace(' ', '')
|
||||||
|
episode_category = episode_category.replace('#', '')
|
||||||
|
if episode_category not in podcast_categories:
|
||||||
|
if valid_hash_tag(episode_category):
|
||||||
|
podcast_categories.append('#' + episode_category)
|
||||||
|
|
||||||
return podcast_categories
|
return podcast_categories
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue