From 0d017381a70fe9f0d774ea0bbc81fed7f204134d Mon Sep 17 00:00:00 2001 From: xrgzs Date: Thu, 26 Sep 2024 01:51:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.ps1 | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/build.ps1 b/build.ps1 index 16b0698..ddcd0a2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -6,24 +6,33 @@ Set-Location $PSScriptRoot # 下载文件 function Get-LanzouFile { param( - [Parameter(Mandatory = $true,Position=0)] + [Parameter(Mandatory = $true, Position = 0)] [string] $Uri, - [Parameter(Mandatory = $true,Position=1)] + [Parameter(Mandatory = $true, Position = 1)] [string] $OutFile ) - + Write-Host "Downloading $Uri to $OutFile..." try { - Invoke-WebRequest -Uri "https://api.xrgzs.top/lanzou/?type=down&url=$Uri" -OutFile $OutFile -ErrorAction Stop -ConnectionTimeoutSeconds 3 + Write-Host "Using api.xrgzs.top..." + Invoke-WebRequest -Uri "https://api.xrgzs.top/lanzou/?type=down&url=$Uri" -OutFile $OutFile -ConnectionTimeoutSeconds 5 -AllowInsecureRedirect + } catch { try { - Invoke-WebRequest -Uri "https://api.hanximeng.com/lanzou/?type=down&url=$Uri" -OutFile $OutFile -ErrorAction Stop -ConnectionTimeoutSeconds 3 + Write-Host "Using api.hanximeng.com..." + Invoke-WebRequest -Uri "https://api.hanximeng.com/lanzou/?type=down&url=$Uri" -OutFile $OutFile -ConnectionTimeoutSeconds 5 -AllowInsecureRedirect } catch { - Invoke-WebRequest -Uri "https://lz.qaiu.top/parser?url=$Uri" -OutFile $OutFile -ErrorAction Stop -ConnectionTimeoutSeconds 3 + try { + Write-Host "Using lz.qaiu.top..." + Invoke-WebRequest -Uri "https://lz.qaiu.top/parser?url=$Uri" -OutFile $OutFile -ConnectionTimeoutSeconds 5 -AllowInsecureRedirect + } + catch { + Write-Error "Failed to download $Uri. ($_)" + } } } } @@ -47,8 +56,8 @@ else { Get-LanzouFile -Uri "https://xrgzs.lanzouv.com/ixdbP27giisf" -OutFile "osc\xrsoft.exe" # 下载其他文件 - Invoke-WebRequest -Uri "http://url.xrgzs.top/osconline" -OutFile "osc\oscoffline.bat" -ErrorAction Stop -ConnectionTimeoutSeconds 3 - Invoke-WebRequest -Uri "http://url.xrgzs.top/oscsoft" -OutFile "osc\oscsoftof.txt" -ErrorAction Stop -ConnectionTimeoutSeconds 3 + Invoke-WebRequest -Uri "http://url.xrgzs.top/osconline" -OutFile "osc\oscoffline.bat" -ErrorAction Stop + Invoke-WebRequest -Uri "http://url.xrgzs.top/oscsoft" -OutFile "osc\oscsoftof.txt" -ErrorAction Stop } # 构建