aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader/f4m.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-03-27 07:41:19 +0600
committerSergey M․ <dstftw@gmail.com>2016-03-27 07:41:19 +0600
commitf7df343b4a0223698f0a5320b850410d7a42be6f (patch)
tree030ca6e0eca03b4d6ccd0621b90f35af86ce418a /youtube_dl/downloader/f4m.py
parent19dbaeece321c51fa336ef142507adf440e22e22 (diff)
[downloader/f4m] Extract routine for removing unsupported encrypted media
Diffstat (limited to 'youtube_dl/downloader/f4m.py')
-rw-r--r--youtube_dl/downloader/f4m.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/youtube_dl/downloader/f4m.py b/youtube_dl/downloader/f4m.py
index fc9642905..664d87543 100644
--- a/youtube_dl/downloader/f4m.py
+++ b/youtube_dl/downloader/f4m.py
@@ -223,6 +223,12 @@ def write_metadata_tag(stream, metadata):
write_unsigned_int(stream, FLV_TAG_HEADER_LEN + len(metadata))
+def remove_encrypted_media(media):
+ return list(filter(lambda e: 'drmAdditionalHeaderId' not in e.attrib and
+ 'drmAdditionalHeaderSetId' not in e.attrib,
+ media))
+
+
def _add_ns(prop):
return '{http://ns.adobe.com/f4m/1.0}%s' % prop
@@ -244,9 +250,7 @@ class F4mFD(FragmentFD):
# without drmAdditionalHeaderId or drmAdditionalHeaderSetId attribute
if 'id' not in e.attrib:
self.report_error('Missing ID in f4m DRM')
- media = list(filter(lambda e: 'drmAdditionalHeaderId' not in e.attrib and
- 'drmAdditionalHeaderSetId' not in e.attrib,
- media))
+ media = remove_encrypted_media(media)
if not media:
self.report_error('Unsupported DRM')
return media