YoutubeExtractor icon indicating copy to clipboard operation
YoutubeExtractor copied to clipboard

Speed up for YoutubeExtractor.Decipherer class

Open digydigy opened this issue 9 years ago • 4 comments

       	static Dictionary<string, string> _Ciphers = new Dictionary<string, string>();
	static string GetJs(string cipherVersion)
	{
		string jsUrl = string.Format("http://s.ytimg.com/yts/jsbin/player-{0}.js", cipherVersion);

		lock (_Ciphers)
		{
			if (_Ciphers.ContainsKey(cipherVersion))
				return _Ciphers[cipherVersion];
			string js = HttpHelper.DownloadString(jsUrl);
			_Ciphers.Add(cipherVersion, js);
			return js;
		}
	}

	public static string DecipherWithVersion(string cipher, string cipherVersion)
	{
		string js = GetJs(cipherVersion);

		//Find "C" in this: var A = B.sig||C (B.s)
		........
		........

digydigy avatar Dec 17 '16 20:12 digydigy

im not sure what your doing here for i am learning using youtube api to bring items in and if sig is required i use this to decode.i have learned to keep a string of the js returned by the call because the sigs change in each item so only one call is required for each video for all formats

thehighboy avatar Dec 23 '16 08:12 thehighboy

@thehighboy

im not sure what your doing

You are right...

digydigy avatar Dec 23 '16 20:12 digydigy

Player source code is 1-2mb on average

Tyrrrz avatar Mar 01 '17 13:03 Tyrrrz

when i see your lock, i think you boosted more then buffering the json^^

RealManOfFewWords avatar Mar 04 '17 14:03 RealManOfFewWords