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