From f052cabca5c4653d9545dea26cb1e40dcd926603 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 21 Apr 2022 10:21:25 +0100 Subject: [PATCH] Update socialInteract url from podcast spec --- newswire.py | 13 ++++++++++--- webapp_podcast.py | 9 +++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/newswire.py b/newswire.py index e5f4a1740..089612524 100644 --- a/newswire.py +++ b/newswire.py @@ -473,11 +473,18 @@ def _valid_podcast_entry(base_dir: str, key: str, entry: {}) -> bool: if key == 'socialInteract': if not entry.get('protocol'): return False - if not entry.get('text'): - return False + if not entry.get('uri'): + if not entry.get('text'): + if not entry.get('url'): + return False if entry['protocol'].tolower() != 'activitypub': return False - post_url = entry['text'] + if entry.get('uri'): + post_url = entry['uri'] + elif entry.get('url'): + post_url = entry['uri'] + else: + post_url = entry['text'] if '://' not in post_url: return False post_domain, post_port = get_domain_from_actor(post_url) diff --git a/webapp_podcast.py b/webapp_podcast.py index 927ae75a1..0b6d8d6c7 100644 --- a/webapp_podcast.py +++ b/webapp_podcast.py @@ -30,9 +30,14 @@ def _html_podcast_social_interactions(podcast_properties: {}, return '' if not podcast_properties.get('socialInteract'): return '' - if not podcast_properties['socialInteract'].get('text'): + if podcast_properties['socialInteract'].get('uri'): + episode_post_url = podcast_properties['socialInteract']['uri'] + elif podcast_properties['socialInteract'].get('url'): + episode_post_url = podcast_properties['socialInteract']['url'] + elif podcast_properties['socialInteract'].get('text'): + episode_post_url = podcast_properties['socialInteract']['text'] + else: return '' - episode_post_url = podcast_properties['socialInteract']['text'] actor_str = '' podcast_account_id = None if podcast_properties['socialInteract'].get('accountId'):