fix hls test
authorAllan Zhou <allanzp@gmail.com>
Wed, 21 Aug 2013 06:51:05 +0000 (23:51 -0700)
committerAllan Zhou <allanzp@gmail.com>
Wed, 21 Aug 2013 06:51:05 +0000 (23:51 -0700)
youtube_dl/extractor/youtube.py

index e573b021d99a567d64935931c3352b6c72785131..1599dd484cf79815a6cf9da0069352802b0cad1b 100644 (file)
@@ -778,13 +778,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
                 self.to_screen(u'%s: Encrypted signatures detected.' % video_id)
                 video_info['url_encoded_fmt_stream_map'] = [args['url_encoded_fmt_stream_map']]
             m_s = re.search(r'[&,]s=', args.get('adaptive_fmts', u''))
-            if 'url_encoded_fmt_stream_map' not in video_info or not video_info['url_encoded_fmt_stream_map']:
-                video_info['url_encoded_fmt_stream_map'] = ['']
             if m_s is not None:
-                video_info['url_encoded_fmt_stream_map'][0] += ','+args['adaptive_fmts']
+                if 'url_encoded_fmt_stream_map' in video_info:
+                    video_info['url_encoded_fmt_stream_map'][0] += ',' + args['adaptive_fmts']
+                else:
+                    video_info['url_encoded_fmt_stream_map'] = [args['adaptive_fmts']]
             elif 'adaptive_fmts' in video_info:
-                video_info['url_encoded_fmt_stream_map'][0] += ','+video_info['adaptive_fmts'][0]
-
+                if 'url_encoded_fmt_stream_map' in video_info:
+                    video_info['url_encoded_fmt_stream_map'][0] += ',' + video_info['adaptive_fmts'][0]
+                else:
+                    video_info['url_encoded_fmt_stream_map'] = video_info['adaptive_fmts']
         except ValueError:
             pass