[mastodon] support for soapbox and audio files
This commit is contained in:
parent
c4ccab8371
commit
38060e3efc
|
@ -45,6 +45,7 @@ class MastodonSHIE(SelfhostedInfoExtractor):
|
||||||
'<li><a href="https://docs.joinmastodon.org/">Documentation</a></li>',
|
'<li><a href="https://docs.joinmastodon.org/">Documentation</a></li>',
|
||||||
'<title>Pleroma</title>',
|
'<title>Pleroma</title>',
|
||||||
'<noscript>To use Pleroma, please enable JavaScript.</noscript>',
|
'<noscript>To use Pleroma, please enable JavaScript.</noscript>',
|
||||||
|
'<noscript>To use Soapbox, please enable JavaScript.</noscript>',
|
||||||
'Alternatively, try one of the <a href="https://apps.gab.com">native apps</a> for Gab Social for your platform.',
|
'Alternatively, try one of the <a href="https://apps.gab.com">native apps</a> for Gab Social for your platform.',
|
||||||
)
|
)
|
||||||
_SH_VALID_CONTENT_REGEXES = (
|
_SH_VALID_CONTENT_REGEXES = (
|
||||||
|
@ -96,6 +97,14 @@ class MastodonSHIE(SelfhostedInfoExtractor):
|
||||||
'title': 're:.+ - He shoots, he scores and the crowd went wild.... #Animal #Sports',
|
'title': 're:.+ - He shoots, he scores and the crowd went wild.... #Animal #Sports',
|
||||||
'ext': 'mp4',
|
'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):
|
def _selfhosted_extract(self, url, webpage=None):
|
||||||
|
@ -118,12 +127,13 @@ class MastodonSHIE(SelfhostedInfoExtractor):
|
||||||
|
|
||||||
entries = []
|
entries = []
|
||||||
for media in metadata['media_attachments']:
|
for media in metadata['media_attachments']:
|
||||||
if media['type'] == 'video':
|
if media['type'] in ('video', 'audio'):
|
||||||
entries.append({
|
entries.append({
|
||||||
'id': media['id'],
|
'id': media['id'],
|
||||||
'title': str_or_none(media['description']),
|
'title': str_or_none(media['description']),
|
||||||
'url': str_or_none(media['url']),
|
'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:
|
if len(entries) == 0:
|
||||||
raise ExtractorError('No audio/video attachments')
|
raise ExtractorError('No audio/video attachments')
|
||||||
|
|
Loading…
Reference in a new issue