Repository: ytdl-org/youtube-dl

Issue:
Unable to decrypt signature length 93
deploy@dos:~$ youtube-dl -U
youtube-dl is up-to-date (2013.09.17)
deploy@dos:~$ youtube-dl http://www.youtube.com/watch?v=g_aMmSWd9M8 --verbose
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['http://www.youtube.com/watch?v=g_aMmSWd9M8', '--verbose']
[debug] youtube-dl version 2013.09.17
[debug] Python version 2.7.3 - Linux-3.2.0-24-virtual-i686-with-Ubuntu-12.04-precise
[debug] Proxy map: {}
[youtube] Setting language
[youtube] g_aMmSWd9M8: Downloading video webpage
[youtube] g_aMmSWd9M8: Downloading video info webpage
[youtube] g_aMmSWd9M8: Extracting video information
[youtube] g_aMmSWd9M8: Encrypted signatures detected.
[youtube] encrypted signature length 93 (46.46), itag 43, html5 player vfl79wBKW
ERROR: Unable to decrypt signature, key length 93 not supported; retrying might work; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
Traceback (most recent call last):
  File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 321, in extract_info
    ie_result = ie.extract(url)
  File "/usr/bin/youtube-dl/youtube_dl/extractor/common.py", line 103, in extract
    return self._real_extract(url)
  File "/usr/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 800, in _real_extract
    signature = self._decrypt_signature(encrypted_sig)
  File "/usr/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 447, in _decrypt_signature
    raise ExtractorError(u'Unable to decrypt signature, key length %d not supported; retrying might work' % (len(s)))



Discussion:
Same issue...

> ~/git/rg3-youtube-dl/youtube-dl --verbose 'http://www.youtube.com/watch?v=V_nC4IGAkH8'
> [debug] System config: []
> [debug] User config: []
> [debug] Command-line args: ['--verbose', 'http://www.youtube.com/watch?v=V_nC4IGAkH8']
> [debug] youtube-dl version 2013.09.17
> [debug] Python version 2.7.2 - Darwin-12.5.0-x86_64-i386-64bit
> [debug] Proxy map: {}
> [youtube] Setting language
> [youtube] V_nC4IGAkH8: Downloading video webpage
> [youtube] V_nC4IGAkH8: Downloading video info webpage
> [youtube] V_nC4IGAkH8: Extracting video information
> [youtube] V_nC4IGAkH8: Encrypted signatures detected.
> [youtube] encrypted signature length 93 (46.46), itag 46, html5 player vfl79wBKW
> ERROR: Unable to decrypt signature, key length 93 not supported; retrying might work; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
> Traceback (most recent call last):
>   File "/Users/default/git/rg3-youtube-dl/youtube-dl/youtube_dl/YoutubeDL.py", line 321, in extract_info
>     ie_result = ie.extract(url)
>   File "/Users/default/git/rg3-youtube-dl/youtube-dl/youtube_dl/extractor/common.py", line 103, in extract
>     return self._real_extract(url)
>   File "/Users/default/git/rg3-youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 800, in _real_extract
>     signature = self._decrypt_signature(encrypted_sig)
>   File "/Users/default/git/rg3-youtube-dl/youtube-dl/youtube_dl/extractor/youtube.py", line 447, in _decrypt_signature
>     raise ExtractorError(u'Unable to decrypt signature, key length %d not supported; retrying might work' % (len(s)))
> ExtractorError: Unable to decrypt signature, key length 93 not supported; retrying might work; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.

Same issue here. Also for length 91.

youtube-dl http://www.youtube.com/watch?v=cmSbXsFE3l8 --verbose
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['http://www.youtube.com/watch?v=cmSbXsFE3l8', '--verbose']
[debug] youtube-dl version 2013.09.17
[debug] Python version 2.7.4 - Linux-3.8.0-30-generic-x86_64-with-Ubuntu-13.04-raring
[debug] Proxy map: {}
[youtube] Setting language
[youtube] cmSbXsFE3l8: Downloading video webpage
[youtube] cmSbXsFE3l8: Downloading video info webpage
[youtube] cmSbXsFE3l8: Extracting video information
[youtube] cmSbXsFE3l8: Encrypted signatures detected.
[youtube] encrypted signature length 93 (46.46), itag 46, html5 player vfl79wBKW
ERROR: Unable to decrypt signature, key length 93 not supported; retrying might work; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.
Traceback (most recent call last):
  File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 321, in extract_info
    ie_result = ie.extract(url)
  File "/usr/bin/youtube-dl/youtube_dl/extractor/common.py", line 103, in extract
    return self._real_extract(url)
  File "/usr/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 800, in _real_extract
    signature = self._decrypt_signature(encrypted_sig)
  File "/usr/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 447, in _decrypt_signature
    raise ExtractorError(u'Unable to decrypt signature, key length %d not supported; retrying might work' % (len(s)))
ExtractorError: Unable to decrypt signature, key length 93 not supported; retrying might work; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type  youtube-dl -U  to update.

As usual, they will change the signature every Thursday afternoon or night!  

new sig len 93 algo:

python:
s[86:29:-1] + s[88] + s[28:5:-1]

javascript:
s.slice(30, 87).reverse().join('') + s[88] + s.slice(6, 29).reverse().join('')


Resolving patch:
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -416,7 +416,9 @@ def report_rtmp_download(self):
     def _decrypt_signature(self, s):
         """Turn the encrypted s field into a working signature"""
 
-        if len(s) == 92:
+        if len(s) == 93:
+            return s[86:29:-1] + s[88] + s[28:5:-1]
+        elif len(s) == 92:
             return s[25] + s[3:25] + s[0] + s[26:42] + s[79] + s[43:79] + s[91] + s[80:83]
         elif len(s) == 90:
             return s[25] + s[3:25] + s[2] + s[26:40] + s[77] + s[41:77] + s[89] + s[78:81]


Test patch: