From 9d26047b12938dab30d91680500b2ee9ea38a0f3 Mon Sep 17 00:00:00 2001 From: xrgzs Date: Thu, 8 Aug 2024 14:31:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=84=E5=BB=BA=20=E5=A2=9E=E5=8A=A0APPX?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E8=AF=B7=E6=B1=82=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osc/runtime/getappx.ps1 | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/osc/runtime/getappx.ps1 b/osc/runtime/getappx.ps1 index 8633ead..a4519f3 100644 --- a/osc/runtime/getappx.ps1 +++ b/osc/runtime/getappx.ps1 @@ -1,15 +1,24 @@ function Download-Appx($Name) { Write-Host "Downloading $Name" - $obj = Invoke-WebRequest -Uri "https://store.xr6.xyz/api/GetFiles" ` - -Method "POST" ` - -ContentType "application/x-www-form-urlencoded" ` - -Body @{ + $body = @{ type = 'PackageFamilyName' url = $Name + '_8wekyb3d8bbwe' ring = 'RP' lang = 'zh-CN' } - + while ($true) { + try { + $obj = Invoke-WebRequest -Uri "https://store.xr6.xyz/api/GetFiles" ` + -Method "POST" ` + -ContentType "application/x-www-form-urlencoded" ` + -Body $body + break + } + catch { + Write-Host "请求失败,正在进行重试..." + Start-Sleep -Seconds 3 + } + } foreach ($link in $obj.Links) { if ($link.outerHTML -match '(?<=]*>).*?(?=)') { $linkText = $Matches[0] @@ -18,6 +27,7 @@ function Download-Appx($Name) { if (Test-Path -Path $linkText) { Write-Warning "Already exists, skiping $linkText" } else { + Write-Host "== $linkText ($($link.href))" Invoke-WebRequest -Uri $link.href -OutFile "$PSScriptRoot\Extension\$linkText" } }