Leave out sig if not present (#896)
authorPhilipp Hagemeister <phihag@phihag.de>
Thu, 20 Jun 2013 23:22:47 +0000 (01:22 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Thu, 20 Jun 2013 23:22:47 +0000 (01:22 +0200)
youtube_dl/InfoExtractors.py

index 17e0f83232856270d4e90be6bf18148a4db13d18..8d228d40dc9df44406e96b1eb568d918ccc04544 100755 (executable)
@@ -732,8 +732,11 @@ class YoutubeIE(InfoExtractor):
             for url_data_str in video_info['url_encoded_fmt_stream_map'][0].split(','):
                 url_data = compat_parse_qs(url_data_str)
                 if 'itag' in url_data and 'url' in url_data:
-                    url = url_data['url'][0] + '&signature=' + url_data['sig'][0]
-                    if not 'ratebypass' in url: url += '&ratebypass=yes'
+                    url = url_data['url'][0]
+                    if 'sig' in url_data:
+                        url += '&signature=' + url_data['sig'][0]
+                    if 'ratebypass' not in url:
+                        url += '&ratebypass=yes'
                     url_map[url_data['itag'][0]] = url
 
             format_limit = self._downloader.params.get('format_limit', None)