diff --git a/OF DL/Helpers/APIHelper.cs b/OF DL/Helpers/APIHelper.cs index bfe75fd..fa7b3ca 100644 --- a/OF DL/Helpers/APIHelper.cs +++ b/OF DL/Helpers/APIHelper.cs @@ -420,7 +420,7 @@ public class APIHelper : IAPIHelper return await GetAllSubscriptions(getParams, endpoint, includeRestricted, config); } - public async Task?> GetUsersWithProgress(string typeDisplay, string endpoint, StatusContext ctx, string? typeParam, bool offsetByCount) + public async Task?> GetUsersWithProgress(string typeDisplay, string endpoint, StatusContext ctx, string? typeParam, bool offsetByCount) { int limit = 50; int offset = 0; @@ -438,7 +438,7 @@ public class APIHelper : IAPIHelper try { - Dictionary users = []; + Dictionary users = []; Log.Debug("Calling GetUsersWithProgress"); @@ -627,7 +627,7 @@ public class APIHelper : IAPIHelper } - public async Task?> GetUsersFromList(string endpoint, bool includeRestricted, IDownloadConfig config) + public async Task?> GetUsersFromList(string endpoint, bool includeRestricted, IDownloadConfig config) { var model = new { list = new[] { new { id = int.MaxValue, username = string.Empty, isRestricted = false, isBlocked = false } }, nextOffset = 0, hasMore = false }; @@ -645,7 +645,7 @@ public class APIHelper : IAPIHelper try { - Dictionary users = []; + Dictionary users = []; while (true) { @@ -901,7 +901,7 @@ public class APIHelper : IAPIHelper } - public async Task GetPaidPosts(string endpoint, string folder, string username, int userId, IDownloadConfig config, List paid_post_ids, StatusContext ctx) + public async Task GetPaidPosts(string endpoint, string folder, string username, long userId, IDownloadConfig config, List paid_post_ids, StatusContext ctx) { Log.Debug($"Calling GetPaidPosts - {username}"); @@ -2008,7 +2008,7 @@ public class APIHelper : IAPIHelper } - public async Task GetPaidMessages(string endpoint, string folder, string username, int userId, IDownloadConfig config, StatusContext ctx) + public async Task GetPaidMessages(string endpoint, string folder, string username, long userId, IDownloadConfig config, StatusContext ctx) { Log.Debug($"Calling GetPaidMessages - {username}"); @@ -2071,8 +2071,8 @@ public class APIHelper : IAPIHelper if (paidMessages.list != null && paidMessages.list.Count > 0) { - int ownUserId = Convert.ToInt32(auth.USER_ID); - int[] validUserIds = [ownUserId, userId]; + long ownUserId = Convert.ToInt64(auth.USER_ID); + long[] validUserIds = [ownUserId, userId]; foreach (Purchased.List purchase in paidMessages.list.Where(p => p.responseType == "message").OrderByDescending(p => p.postedAt ?? p.createdAt)) { diff --git a/OF DL/Helpers/Interfaces/IAPIHelper.cs b/OF DL/Helpers/Interfaces/IAPIHelper.cs index e8ec33c..7262d77 100644 --- a/OF DL/Helpers/Interfaces/IAPIHelper.cs +++ b/OF DL/Helpers/Interfaces/IAPIHelper.cs @@ -18,9 +18,9 @@ namespace OF_DL.Helpers Task GetDRMMPDPSSH(string mpdUrl, string policy, string signature, string kvp); Task> GetLists(string endpoint, IDownloadConfig config); Task> GetListUsers(string endpoint, IDownloadConfig config); - Task?> GetUsersFromList(string endpoint, bool includeRestricted, IDownloadConfig config); + Task?> GetUsersFromList(string endpoint, bool includeRestricted, IDownloadConfig config); Task> GetMedia(MediaType mediatype, string endpoint, string? username, string folder, IDownloadConfig config, List paid_post_ids); - Task GetPaidPosts(string endpoint, string folder, string username, int userId, IDownloadConfig config, List paid_post_ids, StatusContext ctx); + Task GetPaidPosts(string endpoint, string folder, string username, long userId, IDownloadConfig config, List paid_post_ids, StatusContext ctx); Task GetPosts(string endpoint, string folder, IDownloadConfig config, List paid_post_ids, StatusContext ctx); Task GetPost(string endpoint, string folder, IDownloadConfig config); Task GetStreams(string endpoint, string folder, IDownloadConfig config, List paid_post_ids, StatusContext ctx); diff --git a/OF DL/Program.cs b/OF DL/Program.cs index a61a4e6..2f764dc 100644 --- a/OF DL/Program.cs +++ b/OF DL/Program.cs @@ -1038,7 +1038,7 @@ public class Program async Task GetUsers(string typeDisplay, string uri, string outputFile, string? typeParam = null, bool offsetByCount = true) { - Dictionary? users = null; + Dictionary? users = null; await AnsiConsole .Status() @@ -1136,7 +1136,7 @@ public class Program Log.Information("Getting Active Subscriptions (Include Restricted: {IncludeRestrictedSubscriptions})", Config.IncludeRestrictedSubscriptions); AnsiConsole.Markup($"[green]Getting Active Subscriptions (Include Restricted: {Config.IncludeRestrictedSubscriptions})\n[/]"); - Dictionary subsActive = await m_ApiHelper.GetActiveSubscriptions("/subscriptions/subscribes", Config.IncludeRestrictedSubscriptions, Config) ?? []; + Dictionary subsActive = await m_ApiHelper.GetActiveSubscriptions("/subscriptions/subscribes", Config.IncludeRestrictedSubscriptions, Config) ?? []; Log.Debug("Subscriptions: "); foreach (KeyValuePair activeSub in subsActive) @@ -1183,41 +1183,40 @@ public class Program } } - KeyValuePair> hasSelectedUsersKVP; - KeyValuePair> hasSelectedUsersKVP = new(false, []); + KeyValuePair> hasSelectedUsersKVP = new(false, []); if (Config.NonInteractiveMode && Config.NonInteractiveModePurchasedTab) { - hasSelectedUsersKVP = new KeyValuePair>(true, new Dictionary { { "PurchasedTab", 0 } }); + hasSelectedUsersKVP = new KeyValuePair>(true, new Dictionary { { "PurchasedTab", 0 } }); } else if (Config.NonInteractiveMode && Config.NonInteractiveSpecificLists is not null && Config.NonInteractiveSpecificLists.Length > 0) { - Dictionary usersFromLists = new(StringComparer.OrdinalIgnoreCase); + Dictionary usersFromLists = new(StringComparer.OrdinalIgnoreCase); foreach (string listName in Config.NonInteractiveSpecificLists) { - if (!lists.TryGetValue(listName, out int listId)) + if (!lists.TryGetValue(listName, out long listId)) continue; Log.Information("Getting Users from list '{ListName:l}' (Include Restricted: {IncludeRestrictedSubscriptions})", listName, Config.IncludeRestrictedSubscriptions); AnsiConsole.Markup($"[green]Getting Users from list '{listName}' (Include Restricted: {Config.IncludeRestrictedSubscriptions})\n[/]"); - Dictionary list = await m_ApiHelper.GetUsersFromList($"/lists/{listId}/users", config.IncludeRestrictedSubscriptions, Config); + Dictionary list = await m_ApiHelper.GetUsersFromList($"/lists/{listId}/users", config.IncludeRestrictedSubscriptions, Config); - foreach ((string username, int id) in list) + foreach ((string username, long id) in list) usersFromLists.TryAdd(username, id); } users = usersFromLists; - hasSelectedUsersKVP = new KeyValuePair>(true, users); + hasSelectedUsersKVP = new KeyValuePair>(true, users); } else if (Config.NonInteractiveMode && Config.NonInteractiveSpecificUsers is not null && Config.NonInteractiveSpecificUsers.Length > 0) { HashSet usernames = [.. Config.NonInteractiveSpecificUsers]; users = users.Where(u => usernames.Contains(u.Key)).ToDictionary(u => u.Key, u => u.Value); - hasSelectedUsersKVP = new KeyValuePair>(true, users); + hasSelectedUsersKVP = new KeyValuePair>(true, users); } else if (Config.NonInteractiveMode && string.IsNullOrEmpty(Config.NonInteractiveModeListName)) { - hasSelectedUsersKVP = new KeyValuePair>(true, users); + hasSelectedUsersKVP = new KeyValuePair>(true, users); } else if (Config.NonInteractiveMode && !string.IsNullOrEmpty(Config.NonInteractiveModeListName)) { @@ -1225,7 +1224,7 @@ public class Program Log.Information("Getting Users from list '{ListName:l}' (Include Restricted: {IncludeRestrictedSubscriptions})", Config.NonInteractiveModeListName, Config.IncludeRestrictedSubscriptions); AnsiConsole.Markup($"[green]Getting Users from list '{Config.NonInteractiveModeListName}' (Include Restricted: {Config.IncludeRestrictedSubscriptions})\n[/]"); users = await m_ApiHelper.GetUsersFromList($"/lists/{listId}/users", config.IncludeRestrictedSubscriptions, Config); - hasSelectedUsersKVP = new KeyValuePair>(true, users); + hasSelectedUsersKVP = new KeyValuePair>(true, users); } if (users.Count <= 0) @@ -1817,7 +1816,7 @@ public class Program Log.Debug($"Calling DownloadMessages - {user.Key}"); AnsiConsole.Markup($"[grey]Getting Unread Chats\n[/]"); - HashSet unreadChats = await GetUsersWithUnreadChats(downloadContext.ApiHelper, downloadContext.DownloadConfig); + HashSet unreadChats = await GetUsersWithUnreadChats(downloadContext.ApiHelper, downloadContext.DownloadConfig); MessageCollection messages = new MessageCollection(); @@ -3588,7 +3587,7 @@ public class Program } } - private static async Task> GetUsersWithUnreadChats(APIHelper apiHelper, IDownloadConfig currentConfig) + private static async Task> GetUsersWithUnreadChats(APIHelper apiHelper, IDownloadConfig currentConfig) { ChatCollection chats = await apiHelper.GetChats($"/chats", currentConfig, onlyUnread: true);