[peertube] bittorrent formats

merge-requests/5/head
Lauren Liberda 2021-03-12 03:04:49 +01:00
parent 58538a2c64
commit 6f3c4fd2f8
1 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import re
from .common import SelfhostedInfoExtractor
from ..compat import compat_str
from ..utils import (
determine_ext,
int_or_none,
parse_resolution,
str_or_none,
@ -65,6 +66,15 @@ class PeerTubeBaseExtractor(SelfhostedInfoExtractor):
else:
f['fps'] = int_or_none(file_.get('fps'))
formats.append(f)
if file_.get('torrentDownloadUrl'):
f = f.copy()
f.update({
'url': file_['torrentDownloadUrl'],
'ext': determine_ext(file_url),
'format_id': '%s-torrent' % format_id,
'protocol': 'bittorrent',
})
formats.append(f)
if files:
self._sort_formats(formats)
info_dict['formats'] = formats