[REFACTOR]
This commit is contained in:
@@ -8,7 +8,6 @@ namespace Manager.YouTube.Util.Cipher;
|
||||
public partial class CipherDecoder
|
||||
{
|
||||
public required string Version { get; init; }
|
||||
public required string OriginalRelativeUrl { get; init; }
|
||||
public readonly IReadOnlySet<ICipherOperation> Operations;
|
||||
|
||||
private CipherDecoder(IEnumerable<ICipherOperation> operations)
|
||||
@@ -25,7 +24,6 @@ public partial class CipherDecoder
|
||||
var operations = await GetCipherOperations(relativeUrl, client);
|
||||
var decoder = new CipherDecoder(operations)
|
||||
{
|
||||
OriginalRelativeUrl = relativeUrl,
|
||||
Version = version
|
||||
};
|
||||
return decoder;
|
||||
|
||||
@@ -9,7 +9,7 @@ public static class CipherManager
|
||||
private static readonly CipherDecoderCollection LoadedCiphers = [];
|
||||
private static readonly ILogger Logger = LogService.RegisterLogger(typeof(CipherManager));
|
||||
|
||||
public static async Task<Result<CipherDecoder>> GetDecoderAsync(ClientState clientState)
|
||||
public static async Task<Result<CipherDecoder>> GetDecoderAsync(ClientState clientState, YouTubeClient? client = null)
|
||||
{
|
||||
var relativePlayerJsUrl = clientState.PlayerJsUrl;
|
||||
if (string.IsNullOrEmpty(relativePlayerJsUrl))
|
||||
@@ -26,7 +26,7 @@ public static class CipherManager
|
||||
|
||||
try
|
||||
{
|
||||
var decoder = await CipherDecoder.CreateAsync(relativePlayerJsUrl, version);
|
||||
var decoder = await CipherDecoder.CreateAsync(relativePlayerJsUrl, version, client);
|
||||
LoadedCiphers.Add(decoder);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -396,7 +396,7 @@ public sealed class YouTubeClient : IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
var decipherDecoderResult = await CipherManager.GetDecoderAsync(state);
|
||||
var decipherDecoderResult = await CipherManager.GetDecoderAsync(state, this);
|
||||
if (!decipherDecoderResult.IsSuccess)
|
||||
{
|
||||
_logger.Warning(decipherDecoderResult.Error?.Description ?? "Failed to get the cipher decoder!");
|
||||
|
||||
Reference in New Issue
Block a user