Repository: ytdl-org/youtube-dl

Issue:
Length 85 changed again?
Using the latest 2013.08.15 release

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', 'http://www.youtube.com/watch?v=LrUvu1mlWco']
[debug] youtube-dl version 2013.08.15
[debug] Python version 2.7.3 - Windows-7-6.1.7601-SP1
[debug] Proxy map: {}
[youtube] Setting language
[youtube] LrUvu1mlWco: Downloading video webpage
[youtube] LrUvu1mlWco: Downloading video info webpage
[youtube] LrUvu1mlWco: Extracting video information
[youtube] LrUvu1mlWco: Encrypted signatures detected.
[youtube] encrypted signature length 85 (43.41), itag 46, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 37, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 45, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 22, html5 player vfl2LOvBh
[youtube] encrypted signature length 83 (43.39), itag 44, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 35, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 43, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 34, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 18, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 5, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 36, html5 player vfl2LOvBh
[youtube] encrypted signature length 85 (43.41), itag 17, html5 player vfl2LOvBh
ERROR: unable to download video
Traceback (most recent call last):
  File "youtube_dl\YoutubeDL.pyo", line 573, in download
  File "youtube_dl\YoutubeDL.pyo", line 327, in extract_info
  File "youtube_dl\YoutubeDL.pyo", line 410, in process_ie_result
  File "youtube_dl\YoutubeDL.pyo", line 357, in process_ie_result
  File "youtube_dl\YoutubeDL.pyo", line 550, in process_info
UnavailableVideoError: HTTP Error 403: Forbidden



Discussion:
new sig len 85 algo:

pairs:
A5A45AF765CFAB3D70A41E28511D26521E3A9CF9709.2407CF5446DE4D9356E4F138F8DD0CE205E05E522
25E50E502EC0DD8F831F4E6539D4ED6445FC7042.9079FC9AAE12562411582E13A07D3BAFC567FA5D

398098D0A602B3AFF8A0472D485ECC6173A9ED0E8C9.20BBD2BC7C7300DAC1C9DE12CB9F3031D20C4D877
78D4C02D1303F9BC21ED9C1CAD0037C7CB2DBB02.9C8E0DE933716CC0584D274AA8FFA3B206A0D89E

python:
s[83:34:-1] + s[0] + s[33:27:-1] + s[3] + s[26:19:-1] + s[34] + s[18:3:-1] + s[27]

javascript:
s.slice(35, 84).reverse().join('') + s[0] + s.slice(28, 34).reverse().join('') + s[3] + s.slice(20, 27).reverse().join('') + s[34] + s.slice(4, 19).reverse().join('') + s[27]


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
@@ -344,7 +344,7 @@ def _decrypt_signature(self, s):
         elif len(s) == 86:
             return s[5:20] + s[2] + s[21:]
         elif len(s) == 85:
-            return s[2:8] + s[0] + s[9:21] + s[65] + s[22:65] + s[84] + s[66:82] + s[21]
+            return s[83:34:-1] + s[0] + s[33:27:-1] + s[3] + s[26:19:-1] + s[34] + s[18:3:-1] + s[27]
         elif len(s) == 84:
             return s[83:27:-1] + s[0] + s[26:5:-1] + s[2:0:-1] + s[27]
         elif len(s) == 83:


Test patch: