summary refs log tree commit diff
diff options
context:
space:
mode:
authorpatrickslin <patrickslin@gmail.com>2013-07-23 17:32:25 -0700
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-07-24 10:20:52 +0200
commit239e3e0cca362a3fecb702fe0ee11701ee3991b6 (patch)
tree971c5154fe70f466bdb15eb1b8bd356c03a05c4d
parentfc492de31dfd8cc0a88988a0f2ea985a35d60975 (diff)
downloadyoutube-dl-239e3e0cca362a3fecb702fe0ee11701ee3991b6.tar.gz
youtube-dl-239e3e0cca362a3fecb702fe0ee11701ee3991b6.tar.xz
youtube-dl-239e3e0cca362a3fecb702fe0ee11701ee3991b6.zip
YoutubeIE: new algo for length 87 (fixes #1105)
Squashed commit from the pull requests #1107, #1109 and #1110.
-rw-r--r--devscripts/youtube_genalgo.py2
-rw-r--r--test/test_youtube_sig.py2
-rw-r--r--youtube_dl/extractor/youtube.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/devscripts/youtube_genalgo.py b/devscripts/youtube_genalgo.py
index 2b3879f0a..4aeca3c50 100644
--- a/devscripts/youtube_genalgo.py
+++ b/devscripts/youtube_genalgo.py
@@ -16,7 +16,7 @@ tests = [
      "J:|}][{=+-_)(*&;%$#@>MNBVCXZASDFGH^KLPOIUYTREWQ0987654321mnbvcxzasdfghrklpoiuytej"),
     # 87
     ("qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$^&*()_-+={[]}|:;?/>.<",
-     "!?;:|}][{=+-_)(*&^$#@/MNBVCXZASqFGHJKLPOIUYTREWQ0987654321mnbvcxzasdfghjklpoiuytr"),
+     "tyuioplkjhgfdsazxcv<nm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$^&*()_-+={[]}|:;?/>"),
     # 86 - vfl_ymO4Z 2013/06/27
     ("qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[|};?/>.<",
      "ertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!/#$%^&*()_-+={[|};?@"),
diff --git a/test/test_youtube_sig.py b/test/test_youtube_sig.py
index 51b300532..6da7c5502 100644
--- a/test/test_youtube_sig.py
+++ b/test/test_youtube_sig.py
@@ -30,7 +30,7 @@ class TestYoutubeSig(unittest.TestCase):
 
     def test_87(self):
         wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$^&*()_-+={[]}|:;?/>.<"
-        right = "!?;:|}][{=+-_)(*&^$#@/MNBVCXZASqFGHJKLPOIUYTREWQ0987654321mnbvcxzasdfghjklpoiuytr"
+        right = "tyuioplkjhgfdsazxcv<nm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$^&*()_-+={[]}|:;?/>"
         self.assertEqual(sig(wrong), right)
 
     def test_86(self):
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 39894ae88..9d3f61be6 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -186,7 +186,7 @@ class YoutubeIE(InfoExtractor):
         elif len(s) == 88:
             return s[48] + s[81:67:-1] + s[82] + s[66:62:-1] + s[85] + s[61:48:-1] + s[67] + s[47:12:-1] + s[3] + s[11:3:-1] + s[2] + s[12]
         elif len(s) == 87:
-            return s[62] + s[82:62:-1] + s[83] + s[61:52:-1] + s[0] + s[51:2:-1]
+            return s[4:23] + s[86] + s[24:85]
         elif len(s) == 86:
             return s[2:63] + s[82] + s[64:82] + s[63]
         elif len(s) == 85: