Skip to content
This repository was archived by the owner on Sep 28, 2020. It is now read-only.

Commit 5bebb56

Browse files
committed
Escaped Characters in Signature Fixed
Dollar Sign wasn't escaped correctly.
1 parent acffe88 commit 5bebb56

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

YoutubeExtractor/YoutubeExtractor/Decipherer.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@ public static string DecipherWithVersion(string cipher, string cipherVersion)
1313
string js = HttpHelper.DownloadString(jsUrl);
1414

1515
//Find "C" in this: var A = B.sig||C (B.s)
16-
string functNamePattern = @"\.sig\s*\|\|(\w+|$)\(";
16+
string functNamePattern = @"\.sig\s*\|\|([a-zA-Z0-9\$]+)\("; //Regex Formed To Find Word or DollarSign
17+
1718
var funcName = Regex.Match(js, functNamePattern).Groups[1].Value;
19+
20+
if (funcName.Contains("$"))
21+
{
22+
funcName = "\\" + funcName; //Due To Dollar Sign Introduction, Need To Escape
23+
}
24+
1825
string funcBodyPattern = @"(?<brace>{([^{}]| ?(brace))*})"; //Match nested angle braces
19-
string funcPattern = string.Format(@"{0}\(\w+\){1}", funcName, funcBodyPattern);
26+
string funcPattern = string.Format(@"{0}\(\w+\){1}", @funcName, funcBodyPattern); //Escape funcName string
2027
var funcBody = Regex.Match(js, funcPattern).Groups["brace"].Value; //Entire sig function
2128
var lines = funcBody.Split(';'); //Each line in sig function
2229

0 commit comments

Comments
 (0)