1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Text . RegularExpressions ;
6+
7+ namespace YoutubeExtractor
8+ {
9+ internal static class Decipherer
10+ {
11+ public static Dictionary < string , string > Ciphers = new Dictionary < string , string >
12+ {
13+ { "vflNzKG7n" , "s3 r s2 r s1 r w67" } ,
14+ { "vfllMCQWM" , "s2 w46 r w27 s2 w43 s2 r" } ,
15+ { "vflJv8FA8" , "s1 w51 w52 r" } ,
16+ { "vflR_cX32" , "s2 w64 s3" } ,
17+ { "vflveGye9" , "w21 w3 s1 r w44 w36 r w41 s1" } ,
18+ { "vflj7Fxxt" , "r s3 w3 r w17 r w41 r s2" } ,
19+ { "vfltM3odl" , "w60 s1 w49 r s1 w7 r s2 r" } ,
20+ { "vflDG7-a-" , "w52 r s3 w21 r s3 r" } ,
21+ { "vfl39KBj1" , "w52 r s3 w21 r s3 r" } ,
22+ { "vflmOfVEX" , "w52 r s3 w21 r s3 r" } ,
23+ { "vflJwJuHJ" , "r s3 w19 r s2" } ,
24+ { "vfl_ymO4Z" , "r s3 w19 r s2" } ,
25+ { "vfl26ng3K" , "r s2 r" } ,
26+ { "vflcaqGO8" , "w24 w53 s2 w31 w4" } ,
27+ { "vflQw-fB4" , "s2 r s3 w9 s3 w43 s3 r w23" } ,
28+ { "vflSAFCP9" , "r s2 w17 w61 r s1 w7 s1" } ,
29+ { "vflART1Nf" , "s3 r w63 s2 r s1" } ,
30+ { "vflLC8JvQ" , "w34 w29 w9 r w39 w24" } ,
31+ { "vflm_D8eE" , "s2 r w39 w55 w49 s3 w56 w2" } ,
32+ { "vflTWC9KW" , "r s2 w65 r" } ,
33+ { "vflRFcHMl" , "s3 w24 r" } ,
34+ { "vflM2EmfJ" , "w10 r s1 w45 s2 r s3 w50 r" } ,
35+ { "vflz8giW0" , "s2 w18 s3" } ,
36+ { "vfl_wGgYV" , "w60 s1 r s1 w9 s3 r s3 r" } ,
37+ { "vfl1HXdPb" , "w52 r w18 r s1 w44 w51 r s1" } ,
38+ { "vflkn6DAl" , "w39 s2 w57 s2 w23 w35 s2" } ,
39+ { "vfl2LOvBh" , "w34 w19 r s1 r s3 w24 r" } ,
40+ { "vfl-bxy_m" , "w48 s3 w37 s2" } ,
41+ { "vflZK4ZYR" , "w19 w68 s1" } ,
42+ { "vflh9ybst" , "w48 s3 w37 s2" } ,
43+ { "vflapUV9V" , "s2 w53 r w59 r s2 w41 s3" } ,
44+ { "vflg0g8PQ" , "w36 s3 r s2" } ,
45+ { "vflHOr_nV" , "w58 r w50 s1 r s1 r w11 s3" } ,
46+ { "vfluy6kdb" , "r w12 w32 r w34 s3 w35 w42 s2" } ,
47+ { "vflkuzxcs" , "w22 w43 s3 r s1 w43" } ,
48+ { "vflGNjMhJ" , "w43 w2 w54 r w8 s1" } ,
49+ { "vfldJ8xgI" , "w11 r w29 s1 r s3" } ,
50+ { "vfl79wBKW" , "s3 r s1 r s3 r s3 w59 s2" } ,
51+ { "vflg3FZfr" , "r s3 w66 w10 w43 s2" } ,
52+ { "vflUKrNpT" , "r s2 r w63 r" } ,
53+ { "vfldWnjUz" , "r s1 w68" } ,
54+ { "vflP7iCEe" , "w7 w37 r s1" } ,
55+ { "vflzVne63" , "w59 s2 r" } ,
56+ { "vflO-N-9M" , "w9 s1 w67 r s3" } ,
57+ { "vflZ4JlpT" , "s3 r s1 r w28 s1" } ,
58+ { "vflDgXSDS" , "s3 r s1 r w28 s1" } ,
59+ { "vflW444Sr" , "r w9 r s1 w51 w27 r s1 r" } ,
60+ { "vflK7RoTQ" , "w44 r w36 r w45" } ,
61+ { "vflKOCFq2" , "s1 r w41 r w41 s1 w15" } ,
62+ { "vflcLL31E" , "s1 r w41 r w41 s1 w15" } ,
63+ { "vflz9bT3N" , "s1 r w41 r w41 s1 w15" } ,
64+ { "vfliZsE79" , "r s3 w49 s3 r w58 s2 r s2" } ,
65+ { "vfljOFtAt" , "r s3 r s1 r w69 r" } ,
66+ { "vflqSl9GX" , "w32 r s2 w65 w26 w45 w24 w40 s2" } ,
67+ { "vflFrKymJ" , "w32 r s2 w65 w26 w45 w24 w40 s2" } ,
68+ { "vflKz4WoM" , "w50 w17 r w7 w65" } ,
69+ { "vflhdWW8S" , "s2 w55 w10 s3 w57 r w25 w41" } ,
70+ { "vfl66X2C5" , "r s2 w34 s2 w39" } ,
71+ { "vflCXG8Sm" , "r s2 w34 s2 w39" } ,
72+ { "vfl_3Uag6" , "w3 w7 r s2 w27 s2 w42 r" } ,
73+ { "vflQdXVwM" , "s1 r w66 s2 r w12" } ,
74+ { "vflCtc3aO" , "s2 r w11 r s3 w28" } ,
75+ { "vflCt6YZX" , "s2 r w11 r s3 w28" } ,
76+ { "vflG49soT" , "w32 r s3 r s1 r w19 w24 s3" } ,
77+ { "vfl4cHApe" , "w25 s1 r s1 w27 w21 s1 w39" } ,
78+ { "vflwMrwdI" , "w3 r w39 r w51 s1 w36 w14" } ,
79+ { "vfl4AMHqP" , "r s1 w1 r w43 r s1 r" } ,
80+ { "vfln8xPyM" , "w36 w14 s1 r s1 w54" } ,
81+ { "vflVSLmnY" , "s3 w56 w10 r s2 r w28 w35" } ,
82+ { "vflkLvpg7" , "w4 s3 w53 s2" } ,
83+ { "vflbxes4n" , "w4 s3 w53 s2" } ,
84+ { "vflmXMtFI" , "w57 s3 w62 w41 s3 r w60 r" } ,
85+ { "vflYDqEW1" , "w24 s1 r s2 w31 w4 w11 r" } ,
86+ { "vflapGX6Q" , "s3 w2 w59 s2 w68 r s3 r s1" } ,
87+ { "vflLCYwkM" , "s3 w2 w59 s2 w68 r s3 r s1" } ,
88+ { "vflcY_8N0" , "s2 w36 s1 r w18 r w19 r" } ,
89+ { "vfl9qWoOL" , "w68 w64 w28 r" } ,
90+ { "vfle-mVwz" , "s3 w7 r s3 r w14 w59 s3 r" } ,
91+ { "vfltdb6U3" , "w61 w5 r s2 w69 s2 r" } ,
92+ { "vflLjFx3B" , "w40 w62 r s2 w21 s3 r w7 s3" } ,
93+ { "vfliqjKfF" , "w40 w62 r s2 w21 s3 r w7 s3" } ,
94+ { "ima-vflxBu-5R" , "w40 w62 r s2 w21 s3 r w7 s3" } ,
95+ { "ima-vflrGwWV9" , "w36 w45 r s2 r" } ,
96+ { "ima-vflCME3y0" , "w8 s2 r w52" } ,
97+ { "ima-vfl1LZyZ5" , "w8 s2 r w52" } ,
98+ { "ima-vfl4_saJa" , "r s1 w19 w9 w57 w38 s3 r s2" } ,
99+ { "ima-en_US-vflP9269H" , "r w63 w37 s3 r w14 r" } ,
100+ { "ima-en_US-vflkClbFb" , "s1 w12 w24 s1 w52 w70 s2" } ,
101+ { "ima-en_US-vflYhChiG" , "w27 r s3" } ,
102+ { "ima-en_US-vflWnCYSF" , "r s1 r s3 w19 r w35 w61 s2" } ,
103+ { "en_US-vflbT9-GA" , "w51 w15 s1 w22 s1 w41 r w43 r" } ,
104+ { "en_US-vflAYBrl7" , "s2 r w39 w43" } ,
105+ { "en_US-vflS1POwl" , "w48 s2 r s1 w4 w35" } ,
106+ { "en_US-vflLMtkhg" , "w30 r w30 w39" } ,
107+ { "en_US-vflbJnZqE" , "w26 s1 w15 w3 w62 w54 w22" } ,
108+ { "en_US-vflgd5txb" , "w26 s1 w15 w3 w62 w54 w22" }
109+ } ;
110+
111+ public static string DecipherWithVersion ( string cipher , string cipherVersion )
112+ {
113+ string operations ;
114+
115+ bool hasCipher = Ciphers . TryGetValue ( cipherVersion , out operations ) ;
116+
117+ if ( ! hasCipher )
118+ {
119+ return String . Empty ;
120+ }
121+
122+ return DecipherWithOperations ( cipher , operations ) ;
123+ }
124+
125+ private static string ApplyOperation ( string cipher , string op )
126+ {
127+ switch ( op [ 0 ] )
128+ {
129+ case 'r' :
130+ return new string ( cipher . ToCharArray ( ) . Reverse ( ) . ToArray ( ) ) ;
131+
132+ case 'w' :
133+ {
134+ int index = GetOpIndex ( op ) ;
135+ return SwapFirstChar ( cipher , index ) ;
136+ }
137+
138+ case 's' :
139+ {
140+ int index = GetOpIndex ( op ) ;
141+ return cipher . Substring ( index ) ;
142+ }
143+
144+ default :
145+ throw new NotImplementedException ( ) ;
146+ }
147+ }
148+
149+ private static string DecipherWithOperations ( string cipher , string operations )
150+ {
151+ return operations . Split ( new [ ] { " " } , StringSplitOptions . RemoveEmptyEntries )
152+ . Aggregate ( cipher , ApplyOperation ) ;
153+ }
154+
155+ private static int GetOpIndex ( string op )
156+ {
157+ string parsed = new Regex ( @".(\d+)" ) . Match ( op ) . Result ( "$1" ) ;
158+ int index = Int32 . Parse ( parsed ) ;
159+
160+ return index ;
161+ }
162+
163+ private static string SwapFirstChar ( string cipher , int index )
164+ {
165+ var builder = new StringBuilder ( cipher ) ;
166+ builder [ 0 ] = cipher [ index ] ;
167+ builder [ index ] = cipher [ 0 ] ;
168+
169+ return builder . ToString ( ) ;
170+ }
171+ }
172+ }
0 commit comments