代码拉取完成,页面将自动刷新
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Add-Type -AssemblyName System.Web
$ProgressPreference = 'SilentlyContinue'
$game_path = ""
Write-Host "$([char]0x6b63)$([char]0x5728)$([char]0x83b7)$([char]0x53d6)$([char]0x62bd)$([char]0x5361)$([char]0x5206)$([char]0x6790)$([char]0x94fe)$([char]0x63a5)..." -ForegroundColor Green
Write-Host " "
if ($args.Length -eq 0) {
$app_data = [Environment]::GetFolderPath('ApplicationData')
$locallow_path = "$app_data\..\LocalLow\miHoYo\$([char]0x5d29)$([char]0x574f)$([char]0xff1a)$([char]0x661f)$([char]0x7a79)$([char]0x94c1)$([char]0x9053)\"
$log_path = "$locallow_path\Player.log"
if (-Not [IO.File]::Exists($log_path)) {
Write-Host "$([char]0x627e)$([char]0x4e0d)$([char]0x5230)$([char]0x65e5)$([char]0x5fd7)$([char]0x6587)" -ForegroundColor Red
Write-Host "$([char]0x8bf7)$([char]0x786e)$([char]0x4fdd)$([char]0x6e38)$([char]0x620f)$([char]0x5b89)$([char]0x88c5)$([char]0x8def)$([char]0x5f84)$([char]0x6ca1)$([char]0x6709)$([char]0x4e2d)$([char]0x6587)"
return
}
$log_lines = Get-Content $log_path -First 11
if ([string]::IsNullOrEmpty($log_lines)) {
$log_path = "$locallow_path\Player-prev.log"
if (-Not [IO.File]::Exists($log_path)) {
Write-Host "$([char]0x627e)$([char]0x4e0d)$([char]0x5230)$([char]0x65e5)$([char]0x5fd7)$([char]0x6587)" -ForegroundColor Red
Write-Host "$([char]0x8bf7)$([char]0x786e)$([char]0x4fdd)$([char]0x6e38)$([char]0x620f)$([char]0x5b89)$([char]0x88c5)$([char]0x8def)$([char]0x5f84)$([char]0x6ca1)$([char]0x6709)$([char]0x4e2d)$([char]0x6587)"
return
}
$log_lines = Get-Content $log_path -First 11
}
if ([string]::IsNullOrEmpty($log_lines)) {
Write-Host "$([char]0x627e)$([char]0x4e0d)$([char]0x5230)$([char]0x65e5)$([char]0x5fd7)$([char]0x6587)" -ForegroundColor Red
Write-Host "$([char]0x8bf7)$([char]0x786e)$([char]0x4fdd)$([char]0x6e38)$([char]0x620f)$([char]0x5b89)$([char]0x88c5)$([char]0x8def)$([char]0x5f84)$([char]0x6ca1)$([char]0x6709)$([char]0x4e2d)$([char]0x6587)"
return
}
$log_lines = $log_lines.split([Environment]::NewLine)
for ($i = 0; $i -lt 10; $i++) {
$log_line = $log_lines[$i]
if ($log_line.startsWith("Loading player data from ")) {
$game_path = $log_line.replace("Loading player data from ", "").replace("data.unity3d", "")
break
}
}
} else {
$game_path = $args[0]
}
if ([string]::IsNullOrEmpty($game_path)) {
Write-Host "$([char]0x627e)$([char]0x4e0d)$([char]0x5230)$([char]0x65e5)$([char]0x5fd7)$([char]0x6587)" -ForegroundColor Red
Write-Host "$([char]0x8bf7)$([char]0x786e)$([char]0x4fdd)$([char]0x6e38)$([char]0x620f)$([char]0x5b89)$([char]0x88c5)$([char]0x8def)$([char]0x5f84)$([char]0x6ca1)$([char]0x6709)$([char]0x4e2d)$([char]0x6587)"
}
$copy_path = [IO.Path]::GetTempPath() + [Guid]::NewGuid().ToString()
# 获取游戏路径下的所有子文件夹
$subfolders = Get-ChildItem -Path "$game_path\webCaches" -Directory
# 初始化最大版本号变量
$maxVersion = "*.*.*.*"
# 遍历子文件夹
foreach ($folder in $subfolders) {
# 获取文件夹名称
$folderName = $folder.Name
# 使用正则表达式匹配版本号
$match = [regex]::Match($folderName, "\d+\.\d+\.\d+\.\d+")
if ($match.Success) {
# 获取匹配到的版本号
$version = $match.Value
# 更新最大版本号
if ($version -gt $maxVersion) {
$maxVersion = $version
}
}
}
# 构建目标路径
$targetPath = Join-Path -Path $game_path -ChildPath "\webCaches\$maxVersion\Cache\Cache_Data\data_2"
Copy-Item -Path "$targetPath" -Destination $copy_path
$cache_data = Get-Content -Encoding UTF8 -Raw $copy_path
Remove-Item -Path $copy_path
$cache_data_split = $cache_data -split '1/0/'
for ($i = $cache_data_split.Length - 1; $i -ge 0; $i--) {
$line = $cache_data_split[$i]
if ($line.StartsWith('http') -and $line.Contains("getGachaLog")) {
$url = ($line -split "\0")[0]
$res = Invoke-WebRequest -Uri $url -ContentType "application/json" -UseBasicParsing | ConvertFrom-Json
if ($res.retcode -eq 0) {
$uri = [Uri]$url
$query = [Web.HttpUtility]::ParseQueryString($uri.Query)
$keys = $query.AllKeys
foreach ($key in $keys) {
# Retain required params
if ($key -eq "authkey") { continue }
if ($key -eq "authkey_ver") { continue }
if ($key -eq "sign_type") { continue }
if ($key -eq "game_biz") { continue }
if ($key -eq "lang") { continue }
if ($key -eq "init_type") { continue }
if ($key -eq "gacha_id") { continue }
if ($key -eq "lang") { continue }
if ($key -eq "device_type") { continue }
if ($key -eq "game_version") { continue }
if ($key -eq "authkey") { continue }
if ($key -eq "region") { continue }
if ($key -eq "timestamp") { continue }
if ($key -eq "gacha_type") { continue }
if ($key -eq "page") { continue }
if ($key -eq "size") { continue }
if ($key -eq "end_id") { continue }
$query.Remove($key)
}
$latest_url = $uri.Scheme + "://" + $uri.Host + $uri.AbsolutePath + "?" + $query.ToString()
Write-Output $latest_url
Set-Clipboard -Value $latest_url
Write-Host " "
Write-Host "$([char]0x62bd)$([char]0x5361)$([char]0x5206)$([char]0x6790)$([char]0x5730)$([char]0x5740)$([char]0x83b7)$([char]0x53d6)$([char]0x6210)$([char]0x529f)$([char]0xff0c)$([char]0x8bf7)$([char]0x590d)$([char]0x5236)$([char]0x5e76)$([char]0x53d1)$([char]0x9001)$([char]0x7ed9)$([char]0x201c)Yunzai$([char]0x201d)$([char]0x66f4)$([char]0x65b0)$([char]0x62bd)$([char]0x5361)$([char]0x8bb0)$([char]0x5f55)"-ForegroundColor Green
Write-Host "$([char]0x795d)$([char]0x60a8)$([char]0x6b27)$([char]0x7687)$([char]0x9644)$([char]0x4f53)$([char]0xff0c)$([char]0x5341)$([char]0x8fde)$([char]0x53cc)$([char]0x9ec4)$([char]0xff0c)$([char]0x5c0f)$([char]0x4fdd)$([char]0x5e95)$([char]0x5fc5)$([char]0x51fa)$([char]0xff01)" -ForegroundColor Yellow
return;
}
}
}
Write-Host "$([char]0x627e)$([char]0x4e0d)$([char]0x5230)$([char]0x65e5)$([char]0x5fd7)$([char]0x6587)" -ForegroundColor Red
Write-Host "$([char]0x8bf7)$([char]0x786e)$([char]0x4fdd)$([char]0x6e38)$([char]0x620f)$([char]0x5b89)$([char]0x88c5)$([char]0x8def)$([char]0x5f84)$([char]0x6ca1)$([char]0x6709)$([char]0x4e2d)$([char]0x6587)"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。