2013-06-26 17:09:25 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# Allow direct execution
|
|
|
|
import os
|
|
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
|
|
|
|
from youtube_dl.extractor.youtube import YoutubeIE
|
|
|
|
from helper import FakeYDL
|
|
|
|
|
2013-07-31 03:45:13 -05:00
|
|
|
ie = YoutubeIE(FakeYDL())
|
|
|
|
sig = ie._decrypt_signature
|
|
|
|
sig_age_gate = ie._decrypt_signature_age_gate
|
2013-06-26 17:09:25 -05:00
|
|
|
|
|
|
|
class TestYoutubeSig(unittest.TestCase):
|
2013-07-18 05:24:16 -05:00
|
|
|
def test_92(self):
|
|
|
|
wrong = "F9F9B6E6FD47029957AB911A964CC20D95A181A5D37A2DBEFD67D403DB0E8BE4F4910053E4E8A79.0B70B.0B80B8"
|
|
|
|
right = "69B6E6FD47029957AB911A9F4CC20D95A181A5D3.A2DBEFD67D403DB0E8BE4F4910053E4E8A7980B7"
|
|
|
|
self.assertEqual(sig(wrong), right)
|
|
|
|
|
|
|
|
def test_90(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[]}|:;?/>.<'`"
|
|
|
|
right = "mrtyuioplkjhgfdsazxcvbne1234567890QWER[YUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={`]}|"
|
|
|
|
self.assertEqual(sig(wrong), right)
|
|
|
|
|
2013-06-26 18:51:10 -05:00
|
|
|
def test_88(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[]}|:;?/>.<"
|
|
|
|
right = "J:|}][{=+-_)(*&;%$#@>MNBVCXZASDFGH^KLPOIUYTREWQ0987654321mnbvcxzasdfghrklpoiuytej"
|
|
|
|
self.assertEqual(sig(wrong), right)
|
2013-06-27 05:24:46 -05:00
|
|
|
|
2013-06-26 18:51:10 -05:00
|
|
|
def test_87(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$^&*()_-+={[]}|:;?/>.<"
|
2013-07-23 19:32:25 -05:00
|
|
|
right = "tyuioplkjhgfdsazxcv<nm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$^&*()_-+={[]}|:;?/>"
|
2013-06-26 18:51:10 -05:00
|
|
|
self.assertEqual(sig(wrong), right)
|
2013-06-27 05:24:46 -05:00
|
|
|
|
2013-06-26 18:51:10 -05:00
|
|
|
def test_86(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[|};?/>.<"
|
2013-07-31 03:45:13 -05:00
|
|
|
right = ">.1}|[{=+-_)(*&^%$#@!MNBVCXZASDFGHJK<POIUYTREW509876L432/mnbvcxzasdfghjklpoiuytre"
|
2013-06-26 18:51:10 -05:00
|
|
|
self.assertEqual(sig(wrong), right)
|
2013-06-27 05:24:46 -05:00
|
|
|
|
2013-06-26 18:51:10 -05:00
|
|
|
def test_85(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[};?/>.<"
|
2013-07-19 10:12:40 -05:00
|
|
|
right = "ertyuiqplkjhgfdsazx$vbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#<%^&*()_-+={[};?/c"
|
2013-06-26 18:51:10 -05:00
|
|
|
self.assertEqual(sig(wrong), right)
|
2013-06-27 05:24:46 -05:00
|
|
|
|
2013-06-26 18:51:10 -05:00
|
|
|
def test_84(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[};?>.<"
|
|
|
|
right = "<.>?;}[{=+-_)(*&^%$#@!MNBVCXZASDFGHJKLPOIUYTREWe098765432rmnbvcxzasdfghjklpoiuyt1"
|
|
|
|
self.assertEqual(sig(wrong), right)
|
2013-06-27 05:24:46 -05:00
|
|
|
|
2013-06-26 18:51:10 -05:00
|
|
|
def test_83(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!#$%^&*()_+={[};?/>.<"
|
2013-07-11 13:21:45 -05:00
|
|
|
right = "urty8ioplkjhgfdsazxcvbqm1234567S90QWERTYUIOPLKJHGFDnAZXCVBNM!#$%^&*()_+={[};?/>.<"
|
2013-06-26 18:51:10 -05:00
|
|
|
self.assertEqual(sig(wrong), right)
|
2013-06-27 05:24:46 -05:00
|
|
|
|
2013-06-26 18:51:10 -05:00
|
|
|
def test_82(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKHGFDSAZXCVBNM!@#$%^&*(-+={[};?/>.<"
|
|
|
|
right = "Q>/?;}[{=+-(*<^%$#@!MNBVCXZASDFGHKLPOIUY8REWT0q&7654321mnbvcxzasdfghjklpoiuytrew9"
|
|
|
|
self.assertEqual(sig(wrong), right)
|
|
|
|
|
2013-07-11 16:47:54 -05:00
|
|
|
def test_81(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKHGFDSAZXCVBNM!@#$%^&*(-+={[};?/>."
|
2013-07-25 15:06:53 -05:00
|
|
|
right = "C>/?;}[{=+-(*&^%$#@!MNBVYXZASDFGHKLPOIU.TREWQ0q87659321mnbvcxzasdfghjkl4oiuytrewp"
|
2013-07-11 16:47:54 -05:00
|
|
|
self.assertEqual(sig(wrong), right)
|
|
|
|
|
2013-07-25 15:50:24 -05:00
|
|
|
def test_79(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKHGFDSAZXCVBNM!@#$%^&*(-+={[};?/"
|
|
|
|
right = "Z?;}[{=+-(*&^%$#@!MNBVCXRASDFGHKLPOIUYT/EWQ0q87659321mnbvcxzasdfghjkl4oiuytrewp"
|
|
|
|
self.assertEqual(sig(wrong), right)
|
2013-07-31 03:45:13 -05:00
|
|
|
|
|
|
|
def test_86_age_gate(self):
|
|
|
|
wrong = "qwertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!@#$%^&*()_-+={[|};?/>.<"
|
|
|
|
right = "ertyuioplkjhgfdsazxcvbnm1234567890QWERTYUIOPLKJHGFDSAZXCVBNM!/#$%^&*()_-+={[|};?@"
|
|
|
|
self.assertEqual(sig_age_gate(wrong), right)
|
2013-07-25 15:50:24 -05:00
|
|
|
|
2013-06-26 17:09:25 -05:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|