diff options
author | 0l-l0 <49962426+0l-l0@users.noreply.github.com> | 2021-01-08 21:09:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 20:09:38 +0000 |
commit | 170e1c19951ce6a87ce0e9157faa32b9a2efe708 (patch) | |
tree | d66fb4ddd04e63f05c295794371fb9755b56cd84 | |
parent | 61e669acff712175362bea01d42d7a154d300289 (diff) |
[peertube] Extract files also from streamingPlaylists (#27728)
JSON objects with an empty "files" tag seem to be a valid PeerTube API
response. In those cases the "files" arrays contained in the
"streamingPlaylists" members can be used instead.
closes #26002
closes #27586
-rw-r--r-- | youtube_dl/extractor/peertube.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/youtube_dl/extractor/peertube.py b/youtube_dl/extractor/peertube.py index c39d12728..c2ca71c71 100644 --- a/youtube_dl/extractor/peertube.py +++ b/youtube_dl/extractor/peertube.py @@ -451,6 +451,18 @@ class PeerTubeIE(InfoExtractor): 'categories': ['Science & Technology'], } }, { + # Issue #26002 + 'url': 'peertube:spacepub.space:d8943b2d-8280-497b-85ec-bc282ec2afdc', + 'info_dict': { + 'id': 'd8943b2d-8280-497b-85ec-bc282ec2afdc', + 'ext': 'mp4', + 'title': 'Dot matrix printer shell demo', + 'uploader_id': '3', + 'timestamp': 1587401293, + 'upload_date': '20200420', + 'uploader': 'Drew DeVault', + } + }, { 'url': 'https://peertube.tamanoir.foucry.net/videos/watch/0b04f13d-1e18-4f1d-814e-4979aa7c9c44', 'only_matching': True, }, { @@ -526,7 +538,15 @@ class PeerTubeIE(InfoExtractor): title = video['name'] formats = [] - for file_ in video['files']: + files = video.get('files') or [] + for playlist in (video.get('streamingPlaylists') or []): + if not isinstance(playlist, dict): + continue + playlist_files = playlist.get('files') + if not (playlist_files and isinstance(playlist_files, list)): + continue + files.extend(playlist_files) + for file_ in files: if not isinstance(file_, dict): continue file_url = url_or_none(file_.get('fileUrl')) |