From 38060e3efcbb890e151a958fa1c902e391e9a81e Mon Sep 17 00:00:00 2001 From: Lauren Liberda Date: Sun, 18 Apr 2021 18:19:33 +0200 Subject: [PATCH] [mastodon] support for soapbox and audio files --- haruhi_dl/extractor/mastodon.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/haruhi_dl/extractor/mastodon.py b/haruhi_dl/extractor/mastodon.py index ff50e35ee..c181e0276 100644 --- a/haruhi_dl/extractor/mastodon.py +++ b/haruhi_dl/extractor/mastodon.py @@ -45,6 +45,7 @@ class MastodonSHIE(SelfhostedInfoExtractor): '
  • Documentation
  • ', 'Pleroma', '', + '', 'Alternatively, try one of the native apps for Gab Social for your platform.', ) _SH_VALID_CONTENT_REGEXES = ( @@ -96,6 +97,14 @@ class MastodonSHIE(SelfhostedInfoExtractor): 'title': 're:.+ - He shoots, he scores and the crowd went wild.... #Animal #Sports', 'ext': 'mp4', }, + }, { + # Soapbox, audio file + 'url': 'https://gleasonator.com/notice/9zvJY6h7jJzwopKAIi', + 'info_dict': { + 'id': '9zvJY6h7jJzwopKAIi', + 'title': 're:.+ - #FEDIBLOCK', + 'ext': 'oga', + }, }] def _selfhosted_extract(self, url, webpage=None): @@ -118,12 +127,13 @@ class MastodonSHIE(SelfhostedInfoExtractor): entries = [] for media in metadata['media_attachments']: - if media['type'] == 'video': + if media['type'] in ('video', 'audio'): entries.append({ 'id': media['id'], 'title': str_or_none(media['description']), 'url': str_or_none(media['url']), - 'thumbnail': str_or_none(media['preview_url']), + 'thumbnail': str_or_none(media['preview_url']) if media['type'] == 'video' else None, + 'vcodec': 'none' if media['type'] == 'audio' else None, }) if len(entries) == 0: raise ExtractorError('No audio/video attachments')