YoutubeIE: new algo for length 86 (fixes #1156)

Now is using the same length as the flash player used for age protected videos, but the algorithm is different, so now for age protected videos it first tries to use the old algo.
This commit is contained in:
Jaime Marquínez Ferrándiz 2013-07-31 10:45:13 +02:00
parent 05afc96b73
commit 75952c6e3d
3 changed files with 35 additions and 6 deletions

View file

@ -10,7 +10,9 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.extractor.youtube import YoutubeIE
from helper import FakeYDL
sig = YoutubeIE(FakeYDL())._decrypt_signature
ie = YoutubeIE(FakeYDL())
sig = ie._decrypt_signature
sig_age_gate = ie._decrypt_signature_age_gate
class TestYoutubeSig(unittest.TestCase):
def test_92(self):
@ -35,7 +37,7 @@ class TestYoutubeSig(unittest.TestCase):
def test_86(self):
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[|};?/>.<"
right = "ertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!/#$%^&*()_-+={[|};?@"
right = ">.1}|[{=+-_)(*&^%$#@!MNBVCXZASDFGHJK<POIUYTREW509876L432/mnbvcxzasdfghjklpoiuytre"
self.assertEqual(sig(wrong), right)
def test_85(self):
@ -67,6 +69,11 @@ class TestYoutubeSig(unittest.TestCase):
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKHGFDSAZXCVBNM!@#$%^&*(-+={[};?/"
right = "Z?;}[{=+-(*&^%$#@!MNBVCXRASDFGHKLPOIUYT/EWQ0q87659321mnbvcxzasdfghjkl4oiuytrewp"
self.assertEqual(sig(wrong), right)
def test_86_age_gate(self):
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[|};?/>.<"
right = "ertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!/#$%^&*()_-+={[|};?@"
self.assertEqual(sig_age_gate(wrong), right)
if __name__ == '__main__':
unittest.main()