Mastodon: Prefer remote_url before instance cached URL when playing media files

This commit is contained in:
Manuel Cortez 2023-04-05 08:29:21 -06:00
parent c6796874c2
commit 0764679164
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790

View File

@ -54,7 +54,11 @@ def get_media_urls(post):
urls = [] urls = []
for media in post.media_attachments: for media in post.media_attachments:
if media.get("type") == "audio" or media.get("type") == "video": 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 return urls
def find_urls(post, include_tags=False): def find_urls(post, include_tags=False):