Skip to content

Commit

Permalink
Fix for missing users and fix for duplicate key error in scrape purch…
Browse files Browse the repository at this point in the history
…ased tab
  • Loading branch information
sim0n00ps committed Oct 31, 2024
1 parent 257325b commit 821d48b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions OF DL/Helpers/APIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public async Task<JObject> GetUserInfoById(string endpoint)
Subscriptions newSubscriptions = new();
string? loopbody = await BuildHeaderAndExecuteRequests(getParams, endpoint, new HttpClient());

if (!string.IsNullOrEmpty(loopbody) && !loopbody.Contains("[]"))
if (!string.IsNullOrEmpty(loopbody) && (!loopbody.Contains("[]") || loopbody.Trim() != "[]"))
{
newSubscriptions = JsonConvert.DeserializeObject<Subscriptions>(loopbody, m_JsonSerializerSettings);
}
Expand Down Expand Up @@ -2045,7 +2045,10 @@ public async Task<Dictionary<string, int>> GetPurchasedTabUsers(string endpoint,
{
if (!config.BypassContentForCreatorsWhoNoLongerExist)
{
purchasedTabUsers.Add($"Deleted User - {purchase.fromUser.id}", purchase.fromUser.id);
if(!purchasedTabUsers.ContainsKey($"Deleted User - {purchase.fromUser.id}"))
{
purchasedTabUsers.Add($"Deleted User - {purchase.fromUser.id}", purchase.fromUser.id);
}
}
Log.Debug("Content creator not longer exists - {0}", purchase.fromUser.id);
}
Expand Down Expand Up @@ -2092,9 +2095,12 @@ public async Task<Dictionary<string, int>> GetPurchasedTabUsers(string endpoint,
{
if (!config.BypassContentForCreatorsWhoNoLongerExist)
{
purchasedTabUsers.Add($"Deleted User - {purchase.fromUser.id}", purchase.fromUser.id);
if(!purchasedTabUsers.ContainsKey($"Deleted User - {purchase.author.id}"))
{
purchasedTabUsers.Add($"Deleted User - {purchase.author.id}", purchase.author.id);
}
}
Log.Debug("Content creator not longer exists - {0}", purchase.fromUser.id);
Log.Debug("Content creator not longer exists - {0}", purchase.author.id);
}
else if (!string.IsNullOrEmpty(user[purchase.author.id.ToString()]["username"].ToString()))
{
Expand Down

0 comments on commit 821d48b

Please sign in to comment.