From 07646791646fcf0161fc57ed0085ffa70f1d5c7b Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Wed, 5 Apr 2023 08:29:21 -0600 Subject: [PATCH] Mastodon: Prefer remote_url before instance cached URL when playing media files --- src/sessions/mastodon/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sessions/mastodon/utils.py b/src/sessions/mastodon/utils.py index 49a4c4a3..d42b856d 100644 --- a/src/sessions/mastodon/utils.py +++ b/src/sessions/mastodon/utils.py @@ -54,7 +54,11 @@ def get_media_urls(post): urls = [] for media in post.media_attachments: if media.get("type") == "audio" or media.get("type") == "video": - urls.append(media.get("url")) + url_keys = ["remote_url", "url"] + for url_key in url_keys: + if media.get(url_key) != None: + urls.append(media.get(url_key)) + break return urls def find_urls(post, include_tags=False):