summary refs log tree commit diff
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo.valsorda@gmail.com>2013-05-09 00:39:10 +0200
committerFilippo Valsorda <filippo.valsorda@gmail.com>2013-05-09 00:39:10 +0200
commit2a36c352a00d8b0c7a82426e409b97266a804c2e (patch)
tree0ed54d78ac4165f9760aa6c317c8c5518ec7758a
parent43b62accbb1b8701b24e4c9103de56e9e33288df (diff)
downloadyoutube-dl-2a36c352a00d8b0c7a82426e409b97266a804c2e.tar.gz
youtube-dl-2a36c352a00d8b0c7a82426e409b97266a804c2e.tar.xz
youtube-dl-2a36c352a00d8b0c7a82426e409b97266a804c2e.zip
Retry to disable YT ratelimit to unlock full bandwidth
This is the second attempt: a60b854d9099e5a286accf8065d1dc9e00a4bfe6
Sometimes the ratelimit=yes is already in the URL, and doubling it
leads to a 403. Now should work on all videos, at least works on all
I could test.

Closes #648
-rwxr-xr-xyoutube_dl/InfoExtractors.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index d66d64f00..ec52cbcff 100755
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -610,10 +610,13 @@ class YoutubeIE(InfoExtractor):
             self.report_rtmp_download()
             video_url_list = [(None, video_info['conn'][0])]
         elif 'url_encoded_fmt_stream_map' in video_info and len(video_info['url_encoded_fmt_stream_map']) >= 1:
-            url_data_strs = video_info['url_encoded_fmt_stream_map'][0].split(',')
-            url_data = [compat_parse_qs(uds) for uds in url_data_strs]
-            url_data = [ud for ud in url_data if 'itag' in ud and 'url' in ud]
-            url_map = dict((ud['itag'][0], ud['url'][0] + '&signature=' + ud['sig'][0]) for ud in url_data)
+            url_map = {}
+            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_map[url_data['itag'][0]] = url
 
             format_limit = self._downloader.params.get('format_limit', None)
             available_formats = self._available_formats_prefer_free if self._downloader.params.get('prefer_free_formats', False) else self._available_formats