[youtube] Use sp field value for signature field name (closes #18841, closes #18927...
authorSergey M․ <dstftw@gmail.com>
Fri, 10 May 2019 01:36:10 +0000 (08:36 +0700)
committerSergey M․ <dstftw@gmail.com>
Fri, 10 May 2019 01:38:05 +0000 (08:38 +0700)
youtube_dl/extractor/youtube.py

index da202b9bce48449d0157ef6c90ed7b45d3bf3823..8619f38381e42f46367f8044ba3552d1b1a0f7dd 100644 (file)
@@ -1987,7 +1987,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
 
                     signature = self._decrypt_signature(
                         encrypted_sig, video_id, player_url, age_gate)
-                    url += '&signature=' + signature
+                    sp = try_get(url_data, lambda x: x['sp'][0], compat_str) or 'signature'
+                    url += '&%s=%s' % (sp, signature)
                 if 'ratebypass' not in url:
                     url += '&ratebypass=yes'