From 6126488199ac7678cb96109c2a32381b5fcc20b9 Mon Sep 17 00:00:00 2001 From: ovnisoftware Date: Thu, 12 Nov 2015 20:40:15 -0500 Subject: [PATCH] Applied Kimmax's issue #150 fix https://github.com/Kimmax/YoutubeExtractor/commit/df65f817d7e77e80df2370baf3dca00f167e7cfd --- YoutubeExtractor/YoutubeExtractor/Decipherer.cs | 7 +++---- YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/YoutubeExtractor/YoutubeExtractor/Decipherer.cs b/YoutubeExtractor/YoutubeExtractor/Decipherer.cs index bfa8de1..5304419 100644 --- a/YoutubeExtractor/YoutubeExtractor/Decipherer.cs +++ b/YoutubeExtractor/YoutubeExtractor/Decipherer.cs @@ -9,7 +9,7 @@ internal static class Decipherer { public static string DecipherWithVersion(string cipher, string cipherVersion) { - string jsUrl = string.Format("http://s.ytimg.com/yts/jsbin/html5player-{0}.js", cipherVersion); + string jsUrl = string.Format("http://s.ytimg.com/yts/jsbin/player-{0}.js", cipherVersion); string js = HttpHelper.DownloadString(jsUrl); //Find "C" in this: var A = B.sig||C (B.s) @@ -22,9 +22,8 @@ public static string DecipherWithVersion(string cipher, string cipherVersion) funcName = "\\" + funcName; //Due To Dollar Sign Introduction, Need To Escape } - string funcBodyPattern = @"(?{([^{}]| ?(brace))*})"; //Match nested angle braces - string funcPattern = string.Format(@"{0}\(\w+\){1}", @funcName, funcBodyPattern); //Escape funcName string - var funcBody = Regex.Match(js, funcPattern).Groups["brace"].Value; //Entire sig function + string funcPattern = @"var " + @funcName + @"=function\(\w+\)\{.*?\};"; //Escape funcName string + var funcBody = Regex.Match(js, funcPattern).Value; //Entire sig function var lines = funcBody.Split(';'); //Each line in sig function string idReverse = "", idSlice = "", idCharSwap = ""; //Hold name for each cipher method diff --git a/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs b/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs index 454be5d..36b6b58 100644 --- a/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs +++ b/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs @@ -230,7 +230,7 @@ private static string GetDecipheredSignature(string htmlPlayerVersion, string si private static string GetHtml5PlayerVersion(JObject json) { - var regex = new Regex(@"html5player-(.+?)\.js"); + var regex = new Regex(@"player-(.+?).js"); string js = json["assets"]["js"].ToString();