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

Commit

Permalink
Merge pull request #100 from Cyano/master
Browse files Browse the repository at this point in the history
Escaped Characters in Signature Fixed
  • Loading branch information
flagbug committed Jan 17, 2015
2 parents acffe88 + 5bebb56 commit 97cbe6f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions YoutubeExtractor/YoutubeExtractor/Decipherer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ public static string DecipherWithVersion(string cipher, string cipherVersion)
string js = HttpHelper.DownloadString(jsUrl);

//Find "C" in this: var A = B.sig||C (B.s)
string functNamePattern = @"\.sig\s*\|\|(\w+|$)\(";
string functNamePattern = @"\.sig\s*\|\|([a-zA-Z0-9\$]+)\("; //Regex Formed To Find Word or DollarSign

var funcName = Regex.Match(js, functNamePattern).Groups[1].Value;

if (funcName.Contains("$"))
{
funcName = "\\" + funcName; //Due To Dollar Sign Introduction, Need To Escape
}

string funcBodyPattern = @"(?<brace>{([^{}]| ?(brace))*})"; //Match nested angle braces
string funcPattern = string.Format(@"{0}\(\w+\){1}", funcName, funcBodyPattern);
string funcPattern = string.Format(@"{0}\(\w+\){1}", @funcName, funcBodyPattern); //Escape funcName string
var funcBody = Regex.Match(js, funcPattern).Groups["brace"].Value; //Entire sig function
var lines = funcBody.Split(';'); //Each line in sig function

Expand Down

0 comments on commit 97cbe6f

Please sign in to comment.