|
@ -20,6 +20,7 @@ from ..utils import ( |
|
|
encodeFilename, |
|
|
encodeFilename, |
|
|
sanitize_open, |
|
|
sanitize_open, |
|
|
parse_m3u8_attributes, |
|
|
parse_m3u8_attributes, |
|
|
|
|
|
update_url_query, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -82,6 +83,7 @@ class HlsFD(FragmentFD): |
|
|
|
|
|
|
|
|
self._prepare_and_start_frag_download(ctx) |
|
|
self._prepare_and_start_frag_download(ctx) |
|
|
|
|
|
|
|
|
|
|
|
extra_param_to_segment_url = info_dict.get('extra_param_to_segment_url') |
|
|
i = 0 |
|
|
i = 0 |
|
|
media_sequence = 0 |
|
|
media_sequence = 0 |
|
|
decrypt_info = {'METHOD': 'NONE'} |
|
|
decrypt_info = {'METHOD': 'NONE'} |
|
@ -95,6 +97,8 @@ class HlsFD(FragmentFD): |
|
|
if re.match(r'^https?://', line) |
|
|
if re.match(r'^https?://', line) |
|
|
else compat_urlparse.urljoin(man_url, line)) |
|
|
else compat_urlparse.urljoin(man_url, line)) |
|
|
frag_filename = '%s-Frag%d' % (ctx['tmpfilename'], i) |
|
|
frag_filename = '%s-Frag%d' % (ctx['tmpfilename'], i) |
|
|
|
|
|
if extra_param_to_segment_url: |
|
|
|
|
|
frag_url = update_url_query(frag_url, extra_param_to_segment_url) |
|
|
success = ctx['dl'].download(frag_filename, {'url': frag_url}) |
|
|
success = ctx['dl'].download(frag_filename, {'url': frag_url}) |
|
|
if not success: |
|
|
if not success: |
|
|
return False |
|
|
return False |
|
@ -120,6 +124,8 @@ class HlsFD(FragmentFD): |
|
|
if not re.match(r'^https?://', decrypt_info['URI']): |
|
|
if not re.match(r'^https?://', decrypt_info['URI']): |
|
|
decrypt_info['URI'] = compat_urlparse.urljoin( |
|
|
decrypt_info['URI'] = compat_urlparse.urljoin( |
|
|
man_url, decrypt_info['URI']) |
|
|
man_url, decrypt_info['URI']) |
|
|
|
|
|
if extra_param_to_segment_url: |
|
|
|
|
|
decrypt_info['URI'] = update_url_query(decrypt_info['URI'], extra_param_to_segment_url) |
|
|
decrypt_info['KEY'] = self.ydl.urlopen(decrypt_info['URI']).read() |
|
|
decrypt_info['KEY'] = self.ydl.urlopen(decrypt_info['URI']).read() |
|
|
elif line.startswith('#EXT-X-MEDIA-SEQUENCE'): |
|
|
elif line.startswith('#EXT-X-MEDIA-SEQUENCE'): |
|
|
media_sequence = int(line[22:]) |
|
|
media_sequence = int(line[22:]) |
|
|