]> gitweb @ CieloNegro.org - youtube-dl.git/blobdiff - youtube_dl/utils.py
[downloader/hls] Add support for AES-128 encrypted segments in hlsnative downloader
[youtube-dl.git] / youtube_dl / utils.py
index 82f67f6cdca2345d8dff1a10dfe2444a898362b9..562031fe110a9a6962c6e5efed2bb311f3059979 100644 (file)
@@ -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