about summary refs log tree commit diff
path: root/youtube_dl/downloader/hls.py
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2016-08-28 17:51:53 +0100
committerRemita Amine <remitamine@gmail.com>2016-08-28 17:51:53 +0100
commitb8079a40bc61326b17a672b073dce6cdfa791fb5 (patch)
treec8f0d0afc80b8b9901fdcbad5a39297bf76bd13e /youtube_dl/downloader/hls.py
parent5bc8a73af69f4aac8b2df6f7c23ecfb4ee72e518 (diff)
downloadyoutube-dl-b8079a40bc61326b17a672b073dce6cdfa791fb5.tar.gz
youtube-dl-b8079a40bc61326b17a672b073dce6cdfa791fb5.tar.xz
youtube-dl-b8079a40bc61326b17a672b073dce6cdfa791fb5.zip
[turner] fix secure m3u8 formats downloading
Diffstat (limited to 'youtube_dl/downloader/hls.py')
-rw-r--r--youtube_dl/downloader/hls.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube_dl/downloader/hls.py b/youtube_dl/downloader/hls.py
index 8dd1b898e..baaff44d5 100644
--- a/youtube_dl/downloader/hls.py
+++ b/youtube_dl/downloader/hls.py
@@ -83,7 +83,10 @@ class HlsFD(FragmentFD):
 
         self._prepare_and_start_frag_download(ctx)
 
+        extra_query = None
         extra_param_to_segment_url = info_dict.get('extra_param_to_segment_url')
+        if extra_param_to_segment_url:
+            extra_query = compat_urlparse.parse_qs(extra_param_to_segment_url)
         i = 0
         media_sequence = 0
         decrypt_info = {'METHOD': 'NONE'}
@@ -97,8 +100,8 @@ class HlsFD(FragmentFD):
                         if re.match(r'^https?://', line)
                         else compat_urlparse.urljoin(man_url, line))
                     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)
+                    if extra_query:
+                        frag_url = update_url_query(frag_url, extra_query)
                     success = ctx['dl'].download(frag_filename, {'url': frag_url})
                     if not success:
                         return False
@@ -124,8 +127,8 @@ class HlsFD(FragmentFD):
                         if not re.match(r'^https?://', decrypt_info['URI']):
                             decrypt_info['URI'] = compat_urlparse.urljoin(
                                 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)
+                        if extra_query:
+                            decrypt_info['URI'] = update_url_query(decrypt_info['URI'], extra_query)
                         decrypt_info['KEY'] = self.ydl.urlopen(decrypt_info['URI']).read()
                 elif line.startswith('#EXT-X-MEDIA-SEQUENCE'):
                     media_sequence = int(line[22:])