aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-06-19 13:25:08 +0800
committerGitHub <noreply@github.com>2016-06-19 13:25:08 +0800
commit6aeb64b67358176f6c29965d0d138be75c2ad972 (patch)
tree51ac9e69175c3174bdbcf281b9bcf6fa651b9a1f /youtube_dl/utils.py
parent6cd64b6806e92b7246aebd89448189180d88db82 (diff)
parente154c65128305fcaf6c6b2d5fd41ecd83e4ec154 (diff)
Merge pull request #8201 from remitamine/hls-aes
[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