diff --git a/MsixvcPackageDownloader/OtherEndpoints.md b/MsixvcPackageDownloader/OtherEndpoints.md new file mode 100644 index 0000000..71f18b3 --- /dev/null +++ b/MsixvcPackageDownloader/OtherEndpoints.md @@ -0,0 +1,6 @@ + +These are all of the endpoints I found relating to MSIXVC link generation: + +- https://packagespc.xboxlive.com/GetBasePackage/ | Get all available information about a given package (Latest base package, .phf files, multiple .xsp files) +- https://packagespc.xboxlive.com/GetSpecificBasePackage// | Get all available information about a given package and its update id. (Note: Does not return information about previous updates, at least from my testing.) +- https://updatespc.xboxlive.com/IsContentUpdateAvailable | POST: `{"ContentId": "", "UpdateId", "", "UpdateMode": }` | Returns information about available updates and their packages. \ No newline at end of file diff --git a/MsixvcPackageDownloader/Program.cs b/MsixvcPackageDownloader/Program.cs index 9483249..cd695ce 100644 --- a/MsixvcPackageDownloader/Program.cs +++ b/MsixvcPackageDownloader/Program.cs @@ -67,20 +67,21 @@ static async Task Main(string[] args) if (!_updateToken.Valid) { if (!authService.UserToken.Valid || !authService.DeviceToken.Valid) - if (await authService.AuthenticateAsync()) - await GetUpdateXSTSToken(authService.UserToken, authService.DeviceToken); - else + { + if (!await authService.AuthenticateAsync()) { Console.WriteLine("Could not regenerate update token. Please restart the app and reauthenticate!"); return; } + } + + await GetUpdateXSTSToken(authService.UserToken, authService.DeviceToken); } - var contentUuid = Guid.TryParse(contentId, out var contentGuid); - if (!contentUuid) + var isValidId = Guid.TryParse(contentId, out var contentGuid); + if (!isValidId) { Console.WriteLine("Error: You entered an invalid content id."); - continue; } else { @@ -90,21 +91,29 @@ static async Task Main(string[] args) var updateResult = await updateHttpClient.SendAsync(updateRequest); if (!updateResult.IsSuccessStatusCode) - Console.WriteLine( - $"Failed to fetch package information. Status Code: {updateResult.StatusCode}"); + Console.WriteLine($"Failed to fetch package information. Status Code: {updateResult.StatusCode}"); else { try { var updateData = await updateResult.Content.ReadAsJsonAsync(); Console.WriteLine("Got response!"); - foreach (var file in updateData.PackageFiles.Where(pred => !pred.FileName.EndsWith(".phf") && !pred.FileName.EndsWith(".xsp"))) // PC files have the .msixvc extension, Xbox files don't have any - Console.WriteLine( - $"{file.FileName} | Size: {file.FileSize} | Link: {file.CdnRootPaths[0] + file.RelativeUrl}"); + + if (updateData.PackageFound) + { + foreach (var file in updateData.PackageFiles.Where(pred => // PC files have the .msixvc extension, Xbox files don't have any + !pred.FileName.EndsWith(".phf") && + !pred.FileName.EndsWith(".xsp"))) + Console.WriteLine($"{file.FileName} | Size: {file.FileSize} | Link: {file.CdnRootPaths[0] + file.RelativeUrl}"); + } + else + { + Console.WriteLine("Error: Server did not find requested package."); + } } catch (Exception e) { - Console.WriteLine("Error while parsing server response."); + Console.WriteLine($"Error while parsing server response. {e}"); } } }