]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
YoutubeIE: add algo for length 81 (closes #1026)
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Thu, 11 Jul 2013 21:47:54 +0000 (23:47 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Thu, 11 Jul 2013 21:47:54 +0000 (23:47 +0200)
devscripts/youtube_genalgo.py
test/test_youtube_sig.py
youtube_dl/extractor/youtube.py

index 34238851350de49bcafe34a845a8b3f1b766aa32..1fce316dd21fcc723f9d2a421a735ce3865dafa0 100644 (file)
@@ -26,6 +26,9 @@ tests = [
     # 82
     ("qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKHGFDSAZXCVBNM!@#$%^&*(-+={[};?/>.<",
      "Q>/?;}[{=+-(*<^%$#@!MNBVCXZASDFGHKLPOIUY8REWT0q&7654321mnbvcxzasdfghjklpoiuytrew9"),
+    # 81
+    ("qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKHGFDSAZXCVBNM!@#$%^&*(-+={[};?/>.",
+     "urty8ioplkjhgfdsazxcvbqm1234567e90QWERTYUIOPLKHGFDSnZXCVBNM!@#$%^&*(-+={[};?/>."),
 ]
 
 def find_matching(wrong, right):
index fe2067bbdf2e09e2e1897ff1dcf7f1876f698e59..bbeb3e2fb47288a4c27f3f50a0931391a4e089ad 100755 (executable)
@@ -53,5 +53,10 @@ class TestYoutubeSig(unittest.TestCase):
         right = "Q>/?;}[{=+-(*<^%$#@!MNBVCXZASDFGHKLPOIUY8REWT0q&7654321mnbvcxzasdfghjklpoiuytrew9"
         self.assertEqual(sig(wrong), right)
 
+    def test_81(self):
+        wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKHGFDSAZXCVBNM!@#$%^&*(-+={[};?/>."
+        right = "urty8ioplkjhgfdsazxcvbqm1234567e90QWERTYUIOPLKHGFDSnZXCVBNM!@#$%^&*(-+={[};?/>."
+        self.assertEqual(sig(wrong), right)
+
 if __name__ == '__main__':
     unittest.main()
index 1c3abd0cb6e1e2624360a8c789f1fdc8ae01baca..91cd2192fc00849b7b9e61450f145951fa3db9c1 100644 (file)
@@ -193,6 +193,8 @@ class YoutubeIE(InfoExtractor):
             return s[6] + s[3:6] + s[33] + s[7:24] + s[0] + s[25:33] + s[53] + s[34:53] + s[24] + s[54:]
         elif len(s) == 82:
             return s[36] + s[79:67:-1] + s[81] + s[66:40:-1] + s[33] + s[39:36:-1] + s[40] + s[35] + s[0] + s[67] + s[32:0:-1] + s[34]
+        elif len(s) == 81:
+            return s[6] + s[3:6] + s[33] + s[7:24] + s[0] + s[25:33] + s[2] + s[34:53] + s[24] + s[54:81]
 
         else:
             raise ExtractorError(u'Unable to decrypt signature, key length %d not supported; retrying might work' % (len(s)))