From 76820c2df7cc5e465362a4d8d8e23c76596d5dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim-Maximilian=20N=C3=BCrnberger?= Date: Fri, 24 Jun 2016 20:27:38 +0200 Subject: [PATCH] Fixes Kimmax/SYMMExtractor/issues#2, Example proj. now has url that triggers decipherer --- YoutubeExtractor/ExampleApplication/Program.cs | 2 +- YoutubeExtractor/YoutubeExtractor/Decipherer.cs | 2 +- YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/YoutubeExtractor/ExampleApplication/Program.cs b/YoutubeExtractor/ExampleApplication/Program.cs index 82c29bc..257640a 100644 --- a/YoutubeExtractor/ExampleApplication/Program.cs +++ b/YoutubeExtractor/ExampleApplication/Program.cs @@ -88,7 +88,7 @@ private static void DownloadVideo(IEnumerable videoInfos) private static void Main() { // Our test youtube link - const string link = "http://www.youtube.com/watch?v=O3UBOOZw-FE"; + const string link = "https://www.youtube.com/watch?v=YQHsXMglC9A"; /* * Get the available video formats. diff --git a/YoutubeExtractor/YoutubeExtractor/Decipherer.cs b/YoutubeExtractor/YoutubeExtractor/Decipherer.cs index 3f42263..65014cb 100644 --- a/YoutubeExtractor/YoutubeExtractor/Decipherer.cs +++ b/YoutubeExtractor/YoutubeExtractor/Decipherer.cs @@ -22,7 +22,7 @@ public static string DecipherWithVersion(string cipher, string cipherVersion) funcName = "\\" + funcName; //Due To Dollar Sign Introduction, Need To Escape } - string funcPattern = @funcName + @"=function\(\w+\)\{.*?\},"; //Escape funcName string + string funcPattern = @"(?!h\.)" + @funcName + @"=function\(\w+\)\{.*?\}"; //Escape funcName string var funcBody = Regex.Match(js, funcPattern, RegexOptions.Singleline).Value; //Entire sig function var lines = funcBody.Split(';'); //Each line in sig function diff --git a/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs b/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs index baaee06..6896edf 100644 --- a/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs +++ b/YoutubeExtractor/YoutubeExtractor/DownloadUrlResolver.cs @@ -13,7 +13,6 @@ namespace YoutubeExtractor public static class DownloadUrlResolver { private const string RateBypassFlag = "ratebypass"; - private const int CorrectSignatureLength = 81; private const string SignatureQuery = "signature"; /// @@ -226,11 +225,6 @@ private static string GetAdaptiveStreamMap(JObject json) private static string GetDecipheredSignature(string htmlPlayerVersion, string signature) { - if (signature.Length == CorrectSignatureLength) - { - return signature; - } - return Decipherer.DecipherWithVersion(signature, htmlPlayerVersion); }