[CHANGE] Remove anon accounts && added simple caching for urls

This commit is contained in:
max
2025-09-17 23:44:02 +02:00
parent 0056a14f79
commit 8a64d6fc64
15 changed files with 235 additions and 50 deletions

View File

@@ -6,7 +6,7 @@ namespace Manager.YouTube;
public static class NetworkService
{
public const string Origin = "https://www.youtube.com";
private static readonly HttpClient HttpClient = new HttpClient();
private static readonly HttpClient HttpClient = new();
public static async Task<Result<string>> MakeRequestAsync(HttpRequestMessage request, YouTubeClient client, bool skipAuthenticationHeader = false)
{
@@ -43,7 +43,7 @@ public static class NetworkService
return ResultError.Fail($"Failed to get file to download, response code: {response.StatusCode}.");
}
var data = await response.Content.ReadAsByteArrayAsync();;
var data = await response.Content.ReadAsByteArrayAsync();
return new DownloadResult(data, response.Content.Headers.ContentType?.MediaType, response.Content.Headers.ContentDisposition?.FileName?.Trim('"'), response.Content.Headers.ContentLength ?? 0);
}