aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorremitamine <remitamine@gmail.com>2016-01-10 20:09:53 +0100
committerRemita Amine <remitamine@gmail.com>2016-06-19 01:01:40 +0100
commite154c65128305fcaf6c6b2d5fd41ecd83e4ec154 (patch)
tree09b3d7dfa5f9e0d8c2d930c94e7fd2b6d0a0684c /youtube_dl/utils.py
parent589568789f500b7a515355a07efec4bcec0f3243 (diff)
[downloader/hls] Add support for AES-128 encrypted segments in hlsnative downloader
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 82f67f6cd..562031fe1 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -2852,3 +2852,12 @@ def decode_packed_codes(code):
return re.sub(
r'\b(\w+)\b', lambda mobj: symbol_table[mobj.group(0)],
obfucasted_code)
+
+
+def parse_m3u8_attributes(attrib):
+ info = {}
+ for (key, val) in re.findall(r'(?P<key>[A-Z0-9-]+)=(?P<val>"[^"]+"|[^",]+)(?:,|$)', attrib):
+ if val.startswith('"'):
+ val = val[1:-1]
+ info[key] = val
+ return info