projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[__init__] Simplify colon presence check
[youtube-dl]
/
youtube_dl
/
downloader
/
f4m.py
diff --git
a/youtube_dl/downloader/f4m.py
b/youtube_dl/downloader/f4m.py
index fc9642905f3fffb5f1ec11f959c36fd486b757f2..3d9337afa3713b1d10428274f8f0c77553ec670e 100644
(file)
--- a/
youtube_dl/downloader/f4m.py
+++ b/
youtube_dl/downloader/f4m.py
@@
-12,13
+12,13
@@
from ..compat import (
compat_urlparse,
compat_urllib_error,
compat_urllib_parse_urlparse,
compat_urlparse,
compat_urllib_error,
compat_urllib_parse_urlparse,
+ compat_struct_pack,
+ compat_struct_unpack,
)
from ..utils import (
encodeFilename,
fix_xml_ampersands,
sanitize_open,
)
from ..utils import (
encodeFilename,
fix_xml_ampersands,
sanitize_open,
- struct_pack,
- struct_unpack,
xpath_text,
)
xpath_text,
)
@@
-31,13
+31,13
@@
class FlvReader(io.BytesIO):
# Utility functions for reading numbers and strings
def read_unsigned_long_long(self):
# Utility functions for reading numbers and strings
def read_unsigned_long_long(self):
- return struct_unpack('!Q', self.read(8))[0]
+ return
compat_
struct_unpack('!Q', self.read(8))[0]
def read_unsigned_int(self):
def read_unsigned_int(self):
- return struct_unpack('!I', self.read(4))[0]
+ return
compat_
struct_unpack('!I', self.read(4))[0]
def read_unsigned_char(self):
def read_unsigned_char(self):
- return struct_unpack('!B', self.read(1))[0]
+ return
compat_
struct_unpack('!B', self.read(1))[0]
def read_string(self):
res = b''
def read_string(self):
res = b''
@@
-194,11
+194,11
@@
def build_fragments_list(boot_info):
def write_unsigned_int(stream, val):
def write_unsigned_int(stream, val):
- stream.write(struct_pack('!I', val))
+ stream.write(
compat_
struct_pack('!I', val))
def write_unsigned_int_24(stream, val):
def write_unsigned_int_24(stream, val):
- stream.write(struct_pack('!I', val)[1:])
+ stream.write(
compat_
struct_pack('!I', val)[1:])
def write_flv_header(stream):
def write_flv_header(stream):
@@
-223,6
+223,12
@@
def write_metadata_tag(stream, metadata):
write_unsigned_int(stream, FLV_TAG_HEADER_LEN + len(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
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')
# 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
if not media:
self.report_error('Unsupported DRM')
return media