diff --git a/epicyon-profile.css b/epicyon-profile.css index 22801b1e6..f8f6f27f2 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -223,6 +223,10 @@ body, html { image-rendering: var(--rendering); } +audio { + width: 100%; +} + video { width: 100%; } diff --git a/newswire.py b/newswire.py index 308e34c4f..8c35fb921 100644 --- a/newswire.py +++ b/newswire.py @@ -228,6 +228,10 @@ def _add_newswire_dict_entry(base_dir: str, domain: str, # 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 @@ -568,10 +572,20 @@ def get_link_from_rss_item(rss_item: str) -> (str, str): if '://' in link: return link, mime_type - link = rss_item.split('')[1] - link = link.split('')[0] - if '://' not in link: - return None, None + if '' in rss_item and '' in rss_item: + link = rss_item.split('')[1] + link = link.split('')[0] + if '://' not in link: + return None, None + elif '' in link_str: + link_str = link_str.split('>')[0] + if 'href="' in link_str: + link_str = link_str.split('href="')[1] + if '"' in link_str: + link = link_str.split('"')[0] + return link, mime_type @@ -610,9 +624,7 @@ def _xml2str_to_dict(base_dir: str, domain: str, xml_str: str, continue if '' not in rss_item: continue - if '' not in rss_item: - continue - if '' not in rss_item: + if '' not in rss_item: continue @@ -709,9 +721,7 @@ def _xml1str_to_dict(base_dir: str, domain: str, xml_str: str, continue if '' not in rss_item: continue - if '' not in rss_item: - continue - if '' not in rss_item: + if '' not in rss_item: continue @@ -794,9 +804,7 @@ def _atom_feed_to_dict(base_dir: str, domain: str, xml_str: str, continue if '' not in atom_item: continue - if '' not in atom_item: - continue - if '' not in atom_item: + if '' not in atom_item: continue @@ -980,7 +988,11 @@ def _atom_feed_yt_to_dict(base_dir: str, domain: str, xml_str: str, atom_items = xml_str.split('') post_ctr = 0 max_bytes = max_feed_item_size_kb * 1024 + first_entry = True for atom_item in atom_items: + if first_entry: + first_entry = False + continue if not atom_item: continue if not atom_item.strip(): diff --git a/tests.py b/tests.py index 4d086b1f8..ea7349a6c 100644 --- a/tests.py +++ b/tests.py @@ -6477,6 +6477,16 @@ def _test_get_link_from_rss_item() -> None: assert link.startswith('https://anchor.fm') assert not mime_type + rss_item = \ + '' + \ + 'Wed, 12 Jan 2022 14:28:46 GMT' + link, mime_type = get_link_from_rss_item(rss_item) + assert link + assert link.startswith('https://test.link/creativecommons') + def run_all_tests(): base_dir = os.getcwd() 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 ''