Попробуйте так:
paste := "xhUTm9C4"
password := "qwerty"
baseUrl := "https://pastebin.com/"
WR := new WebRequest
html := WR.Fetch(baseUrl . paste)
if WR.error
throw WR.error
RegExMatch(html, "name=""_csrf-frontend"" value=""\K[^""]+", _csrf_frontend)
if !_csrf_frontend
throw "_csrf-frontend code not found"
body := "_csrf-frontend=" . EncodeDecodeURI(_csrf_frontend)
. "&is_burn=1"
. "&PostPasswordVerificationForm%5Bpassword%5D=" . EncodeDecodeURI(password)
Headers := { "content-length": StrLen(body)
, "content-type" : "application/x-www-form-urlencoded"
, "pragma" : "no-cache"
, "cache-control" : "no-cache"
, "user-agent" : "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 "
. "(KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.54" }
html := WR.Fetch(baseUrl . paste, "POST", Headers, body)
if WR.error
throw WR.error
WR := ""
Doc := ComObjCreate("htmlfile")
Doc.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=9"">")
Doc.write(html)
textArea := Doc.querySelector("textarea.js-paste-raw")
if !IsObject(textArea)
throw "textarea not found"
code := textArea.value
Doc := ""
MsgBox, % code
class WebRequest
{
__New() {
this.whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
}
__Delete() {
this.whr := ""
}
Fetch(url, method := "GET", HeadersArray := "", body := "", ByRef outData := "") {
this.whr.Open(method, url, true)
for name, value in HeadersArray
this.whr.SetRequestHeader(name, value)
this.error := ""
this.whr.Send(body)
this.whr.WaitForResponse()
status := this.whr.status
if (status != 200)
this.error := "HttpRequest error, status: " . status
Arr := this.whr.responseBody
pData := NumGet(ComObjValue(arr) + 8 + A_PtrSize)
length := Arr.MaxIndex() + 1
if !IsByref(outData)
res := StrGet(pData, length, "UTF-8")
else {
VarSetCapacity(outData, length, 0)
DllCall("RtlMoveMemory", "Ptr", &outData, "Ptr", pData, "Ptr", length)
res := length
}
Return res
}
}
EncodeDecodeURI(str, encode := true, component := true) {
static Doc, JS
if !Doc {
Doc := ComObjCreate("htmlfile")
Doc.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=9"">")
JS := Doc.parentWindow
( Doc.documentMode < 9 && JS.execScript() )
}
Return JS[ (encode ? "en" : "de") . "codeURI" . (component ? "Component" : "") ](str)
}
Если такие запросы делать слишком часто, могут забанить по ip.
Разработка AHK-скриптов:
e-mail
dfiveg@mail.ruTelegram
jollycoder