|
@ -839,6 +839,7 @@ class InfoExtractor(object): |
|
|
note='Downloading m3u8 information', |
|
|
note='Downloading m3u8 information', |
|
|
errnote='Failed to download m3u8 information') |
|
|
errnote='Failed to download m3u8 information') |
|
|
last_info = None |
|
|
last_info = None |
|
|
|
|
|
last_media= None |
|
|
kv_rex = re.compile( |
|
|
kv_rex = re.compile( |
|
|
r'(?P<key>[a-zA-Z_-]+)=(?P<val>"[^"]+"|[^",]+)(?:,|$)') |
|
|
r'(?P<key>[a-zA-Z_-]+)=(?P<val>"[^"]+"|[^",]+)(?:,|$)') |
|
|
for line in m3u8_doc.splitlines(): |
|
|
for line in m3u8_doc.splitlines(): |
|
@ -849,6 +850,13 @@ class InfoExtractor(object): |
|
|
if v.startswith('"'): |
|
|
if v.startswith('"'): |
|
|
v = v[1:-1] |
|
|
v = v[1:-1] |
|
|
last_info[m.group('key')] = v |
|
|
last_info[m.group('key')] = v |
|
|
|
|
|
elif line.startswith('#EXT-X-MEDIA:'): |
|
|
|
|
|
last_media = {} |
|
|
|
|
|
for m in kv_rex.finditer(line): |
|
|
|
|
|
v = m.group('val') |
|
|
|
|
|
if v.startswith('"'): |
|
|
|
|
|
v = v[1:-1] |
|
|
|
|
|
last_media[m.group('key')] = v |
|
|
elif line.startswith('#') or not line.strip(): |
|
|
elif line.startswith('#') or not line.strip(): |
|
|
continue |
|
|
continue |
|
|
else: |
|
|
else: |
|
@ -877,6 +885,9 @@ class InfoExtractor(object): |
|
|
width_str, height_str = resolution.split('x') |
|
|
width_str, height_str = resolution.split('x') |
|
|
f['width'] = int(width_str) |
|
|
f['width'] = int(width_str) |
|
|
f['height'] = int(height_str) |
|
|
f['height'] = int(height_str) |
|
|
|
|
|
if last_media is not None: |
|
|
|
|
|
f['m3u8_media'] = last_media |
|
|
|
|
|
last_media = None |
|
|
formats.append(f) |
|
|
formats.append(f) |
|
|
last_info = {} |
|
|
last_info = {} |
|
|
self._sort_formats(formats) |
|
|
self._sort_formats(formats) |
|
|