[CHANGE] Disabled signature challenge. Need to run js.

This commit is contained in:
max
2025-11-02 19:45:41 +01:00
parent 16343c9a56
commit bf957436f0

View File

@@ -5,12 +5,10 @@ using System.Text.Json;
using System.Text.Json.Nodes;
using DotBased.Logging;
using DotBased.Monads;
using Manager.YouTube.Interpreter;
using Manager.YouTube.Models;
using Manager.YouTube.Models.Innertube;
using Manager.YouTube.Parsers;
using Manager.YouTube.Parsers.Json;
using Manager.YouTube.Util.Cipher;
namespace Manager.YouTube;
@@ -115,7 +113,7 @@ public sealed class YouTubeClient : IDisposable
return videoParseResult;
}
await DecipherSignatures(videoParseResult.Value, state);
//await DecipherSignaturesAsync(videoParseResult.Value, state);
return videoParseResult.Value;
}
@@ -176,10 +174,10 @@ public sealed class YouTubeClient : IDisposable
public async Task<Result> RotateCookiesPageAsync(string origin = NetworkService.Origin, int ytPid = 1)
{
/*if (IsAnonymous)
if (IsAnonymous)
{
return ResultError.Fail("Anonymous clients cannot rotate cookies!");
}*/
}
if (string.IsNullOrWhiteSpace(origin))
{
@@ -387,7 +385,7 @@ public sealed class YouTubeClient : IDisposable
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;
if (streamingData == null)
@@ -395,35 +393,40 @@ public sealed class YouTubeClient : IDisposable
_logger.Debug("No streaming data available, skipping decipher.");
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();
if (formatsWithCipher.Count == 0)
{
_logger.Debug("Skipping decipher, no signatures found to decipher.");
return;
_logger.Debug("Skipping signature decipher, no signatures found to decipher.");
}
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)
{
_logger.Warning(jsEngineResult.Error?.Description ?? "Failed to get player script engine.");
return;
}
var engine = jsEngineResult.Value;
engine.InitializePlayer();
/*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);
}*/
}
engine.InitializePlayer();#1#
}*/
}