mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-28 07:36:52 +01:00
[common] skip drm protected dash formats
This commit is contained in:
parent
d577c79632
commit
675d001633
@ -1355,6 +1355,9 @@ def _parse_mpd(self, mpd_doc, mpd_id=None, mpd_base_url='', formats_dict={}):
|
|||||||
def _add_ns(path):
|
def _add_ns(path):
|
||||||
return self._xpath_ns(path, namespace)
|
return self._xpath_ns(path, namespace)
|
||||||
|
|
||||||
|
def is_drm_protected(element):
|
||||||
|
return element.find(_add_ns('ContentProtection')) is not None
|
||||||
|
|
||||||
def extract_multisegment_info(element, ms_parent_info):
|
def extract_multisegment_info(element, ms_parent_info):
|
||||||
ms_info = ms_parent_info.copy()
|
ms_info = ms_parent_info.copy()
|
||||||
segment_list = element.find(_add_ns('SegmentList'))
|
segment_list = element.find(_add_ns('SegmentList'))
|
||||||
@ -1406,8 +1409,12 @@ def extract_multisegment_info(element, ms_parent_info):
|
|||||||
'timescale': 1,
|
'timescale': 1,
|
||||||
})
|
})
|
||||||
for adaptation_set in period.findall(_add_ns('AdaptationSet')):
|
for adaptation_set in period.findall(_add_ns('AdaptationSet')):
|
||||||
|
if is_drm_protected(adaptation_set):
|
||||||
|
continue
|
||||||
adaption_set_ms_info = extract_multisegment_info(adaptation_set, period_ms_info)
|
adaption_set_ms_info = extract_multisegment_info(adaptation_set, period_ms_info)
|
||||||
for representation in adaptation_set.findall(_add_ns('Representation')):
|
for representation in adaptation_set.findall(_add_ns('Representation')):
|
||||||
|
if is_drm_protected(representation):
|
||||||
|
continue
|
||||||
representation_attrib = adaptation_set.attrib.copy()
|
representation_attrib = adaptation_set.attrib.copy()
|
||||||
representation_attrib.update(representation.attrib)
|
representation_attrib.update(representation.attrib)
|
||||||
mime_type = representation_attrib.get('mimeType')
|
mime_type = representation_attrib.get('mimeType')
|
||||||
|
Loading…
Reference in New Issue
Block a user