This commit is contained in:
Casper Sparre 2025-05-21 18:11:22 +02:00
parent fd14259aa0
commit 5b285acb37

View File

@ -13,6 +13,7 @@ using OF_DL.Enumerations;
using OF_DL.Enumurations;
using Serilog;
using Spectre.Console;
using System.Diagnostics;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
@ -127,6 +128,10 @@ public class APIHelper : IAPIHelper
{
HttpRequestMessage request = await BuildHttpRequestMessage(getParams, endpoint);
using var response = await client.SendAsync(request);
if (response.StatusCode == System.Net.HttpStatusCode.TooManyRequests)
Debugger.Break();
response.EnsureSuccessStatusCode();
string body = await response.Content.ReadAsStringAsync();
@ -469,12 +474,16 @@ public class APIHelper : IAPIHelper
try
{
int limit = 50;
int offset = 0;
Dictionary<string, string> getParams = new()
{
{ "limit", limit.ToString() },
{ "offset", offset.ToString() },
{ "limit", "50" }
{ "format", "infinite"}
};
List<string> users = new();
while (true)
@ -485,6 +494,8 @@ public class APIHelper : IAPIHelper
break;
}
UserList? userList = JsonConvert.DeserializeObject<UserList>(body, m_JsonSerializerSettings);
List<UsersList>? usersList = JsonConvert.DeserializeObject<List<UsersList>>(body);
if (usersList == null || usersList.Count <= 0)
@ -506,6 +517,7 @@ public class APIHelper : IAPIHelper
getParams["offset"] = Convert.ToString(offset);
}
return users;
}
catch (Exception ex)
@ -1159,7 +1171,7 @@ public class APIHelper : IAPIHelper
}
break;
case VideoResolution._240:
if(medium.videoSources != null)
if (medium.videoSources != null)
{
if (!string.IsNullOrEmpty(medium.videoSources._240))
{
@ -1186,7 +1198,7 @@ public class APIHelper : IAPIHelper
}
}
break;
}
}
else if (medium.canView && medium.files != null && medium.files.drm != null)
@ -2143,11 +2155,11 @@ public class APIHelper : IAPIHelper
{
JObject user = await GetUserInfoById($"/users/list?x[]={purchase.fromUser.id}");
if(user is null)
if (user is null)
{
if (!config.BypassContentForCreatorsWhoNoLongerExist)
{
if(!purchasedTabUsers.ContainsKey($"Deleted User - {purchase.fromUser.id}"))
if (!purchasedTabUsers.ContainsKey($"Deleted User - {purchase.fromUser.id}"))
{
purchasedTabUsers.Add($"Deleted User - {purchase.fromUser.id}", purchase.fromUser.id);
}
@ -2197,7 +2209,7 @@ public class APIHelper : IAPIHelper
{
if (!config.BypassContentForCreatorsWhoNoLongerExist)
{
if(!purchasedTabUsers.ContainsKey($"Deleted User - {purchase.author.id}"))
if (!purchasedTabUsers.ContainsKey($"Deleted User - {purchase.author.id}"))
{
purchasedTabUsers.Add($"Deleted User - {purchase.author.id}", purchase.author.id);
}