[CHANGE] Disabled signature challenge. Need to run js.
This commit is contained in:
@@ -5,12 +5,10 @@ using System.Text.Json;
|
|||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using DotBased.Logging;
|
using DotBased.Logging;
|
||||||
using DotBased.Monads;
|
using DotBased.Monads;
|
||||||
using Manager.YouTube.Interpreter;
|
|
||||||
using Manager.YouTube.Models;
|
using Manager.YouTube.Models;
|
||||||
using Manager.YouTube.Models.Innertube;
|
using Manager.YouTube.Models.Innertube;
|
||||||
using Manager.YouTube.Parsers;
|
using Manager.YouTube.Parsers;
|
||||||
using Manager.YouTube.Parsers.Json;
|
using Manager.YouTube.Parsers.Json;
|
||||||
using Manager.YouTube.Util.Cipher;
|
|
||||||
|
|
||||||
namespace Manager.YouTube;
|
namespace Manager.YouTube;
|
||||||
|
|
||||||
@@ -115,7 +113,7 @@ public sealed class YouTubeClient : IDisposable
|
|||||||
return videoParseResult;
|
return videoParseResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
await DecipherSignatures(videoParseResult.Value, state);
|
//await DecipherSignaturesAsync(videoParseResult.Value, state);
|
||||||
|
|
||||||
return videoParseResult.Value;
|
return videoParseResult.Value;
|
||||||
}
|
}
|
||||||
@@ -176,10 +174,10 @@ public sealed class YouTubeClient : IDisposable
|
|||||||
|
|
||||||
public async Task<Result> RotateCookiesPageAsync(string origin = NetworkService.Origin, int ytPid = 1)
|
public async Task<Result> RotateCookiesPageAsync(string origin = NetworkService.Origin, int ytPid = 1)
|
||||||
{
|
{
|
||||||
/*if (IsAnonymous)
|
if (IsAnonymous)
|
||||||
{
|
{
|
||||||
return ResultError.Fail("Anonymous clients cannot rotate cookies!");
|
return ResultError.Fail("Anonymous clients cannot rotate cookies!");
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(origin))
|
if (string.IsNullOrWhiteSpace(origin))
|
||||||
{
|
{
|
||||||
@@ -387,7 +385,7 @@ public sealed class YouTubeClient : IDisposable
|
|||||||
return ResultError.Fail("Failed to get datasyncIds! Client not logged in.");
|
return ResultError.Fail("Failed to get datasyncIds! Client not logged in.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DecipherSignatures(YouTubeVideo video, ClientState state)
|
/*private async Task DecipherSignaturesAsync(YouTubeVideo video, ClientState state)
|
||||||
{
|
{
|
||||||
var streamingData = video.StreamingData;
|
var streamingData = video.StreamingData;
|
||||||
if (streamingData == null)
|
if (streamingData == null)
|
||||||
@@ -395,35 +393,40 @@ public sealed class YouTubeClient : IDisposable
|
|||||||
_logger.Debug("No streaming data available, skipping decipher.");
|
_logger.Debug("No streaming data available, skipping decipher.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(state.PlayerJsUrl))
|
||||||
|
{
|
||||||
|
_logger.Warning("No player js url found.");
|
||||||
|
}
|
||||||
|
|
||||||
var formatsWithCipher = streamingData.Formats.Concat(streamingData.AdaptiveFormats).Where(x => !string.IsNullOrWhiteSpace(x.SignatureCipher)).ToList();
|
var formatsWithCipher = streamingData.Formats.Concat(streamingData.AdaptiveFormats).Where(x => !string.IsNullOrWhiteSpace(x.SignatureCipher)).ToList();
|
||||||
if (formatsWithCipher.Count == 0)
|
if (formatsWithCipher.Count == 0)
|
||||||
{
|
{
|
||||||
_logger.Debug("Skipping decipher, no signatures found to decipher.");
|
_logger.Debug("Skipping signature decipher, no signatures found to decipher.");
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(streamingData.ServerAbrStreamingUrl))
|
||||||
|
{
|
||||||
|
_logger.Warning("No ABR streaming url available.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var abrStreamUri = new Uri(streamingData.ServerAbrStreamingUrl);
|
||||||
|
var queries = HttpUtility.ParseQueryString(abrStreamUri.Query);
|
||||||
|
var nSig = queries.Get("n");
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(nSig))
|
||||||
|
{
|
||||||
|
_logger.Warning("No N signature found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var jsEngineResult = await JavaScriptEngineManager.GetPlayerEngine(state.PlayerJsUrl ?? "");
|
/*var jsEngineResult = await JavaScriptEngineManager.GetPlayerEngine(state.PlayerJsUrl ?? "");
|
||||||
if (!jsEngineResult.IsSuccess)
|
if (!jsEngineResult.IsSuccess)
|
||||||
{
|
{
|
||||||
_logger.Warning(jsEngineResult.Error?.Description ?? "Failed to get player script engine.");
|
_logger.Warning(jsEngineResult.Error?.Description ?? "Failed to get player script engine.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var engine = jsEngineResult.Value;
|
var engine = jsEngineResult.Value;
|
||||||
engine.InitializePlayer();
|
engine.InitializePlayer();#1#
|
||||||
|
}*/
|
||||||
/*var decipherDecoderResult = await CipherManager.GetDecoderAsync(state, this);
|
|
||||||
if (!decipherDecoderResult.IsSuccess)
|
|
||||||
{
|
|
||||||
_logger.Warning(decipherDecoderResult.Error?.Description ?? "Failed to get the cipher decoder!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var decoder = decipherDecoderResult.Value;
|
|
||||||
|
|
||||||
foreach (var format in formatsWithCipher)
|
|
||||||
{
|
|
||||||
format.Url = decoder.Decipher(format.SignatureCipher);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user