38 lines
1.6 KiB
PowerShell
38 lines
1.6 KiB
PowerShell
# fetch_qmt_docs.ps1 - runs OUTSIDE the sandbox via UAC elevation
|
|
# Fetches thinktrader official doc pages and saves them.
|
|
$ErrorActionPreference = "Stop"
|
|
$outDir = "C:\Users\Docker\AppData\Local\Temp\qmt_docs"
|
|
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
|
|
$log = "C:\Users\Docker\AppData\Local\Temp\qmt_docs_fetch_log.txt"
|
|
|
|
# Bypass SSL validation
|
|
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
|
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
|
|
|
|
$ip = "119.147.202.116"
|
|
$hostname = "dict.thinktrader.net"
|
|
|
|
$pages = @(
|
|
@{ name = "get_full_tick"; path = "/innerApi/data_function.html" },
|
|
@{ name = "subscribe_whole_quote"; path = "/innerApi/data_function.html" }
|
|
)
|
|
|
|
foreach ($page in $pages) {
|
|
try {
|
|
$req = [System.Net.HttpWebRequest]::Create("https://$ip$($page.path)")
|
|
$req.Host = $hostname
|
|
$req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
|
|
$req.Timeout = 30000
|
|
$req.ServerCertificateValidationCallback = { $true }
|
|
$resp = $req.GetResponse()
|
|
$reader = New-Object System.IO.StreamReader($resp.GetResponseStream())
|
|
$content = $reader.ReadToEnd()
|
|
$outFile = Join-Path $outDir ($page.name + ".html")
|
|
[System.IO.File]::WriteAllText($outFile, $content, [System.Text.Encoding]::UTF8)
|
|
"OK $($page.name): HTTP $([int]$resp.StatusCode) len=$($content.Length) -> $outFile" | Out-File $log -Append -Encoding utf8
|
|
$resp.Close()
|
|
} catch {
|
|
"ERROR $($page.name): $($_.Exception.Message)" | Out-File $log -Append -Encoding utf8
|
|
}
|
|
}
|