Add files via upload
This commit is contained in:
parent
300e00cdb4
commit
5f11153569
6 changed files with 734 additions and 0 deletions
70
py_arkose_generator/arkose.py
Normal file
70
py_arkose_generator/arkose.py
Normal file
|
@ -0,0 +1,70 @@
|
|||
import random
|
||||
|
||||
from . import util
|
||||
|
||||
|
||||
def get_values_for_request(options):
|
||||
options = {
|
||||
"data": {},
|
||||
"pkey": "3D86FBBA-9D22-402A-B512-3420086BA6CC",
|
||||
"surl": "https://tcr9i.chat.openai.com",
|
||||
"headers": {"User-Agent": util.DEFAULT_USER_AGENT},
|
||||
"site": "https://chat.openai.com",
|
||||
**options,
|
||||
}
|
||||
|
||||
if "headers" not in options:
|
||||
options["headers"] = {"User-Agent": util.DEFAULT_USER_AGENT}
|
||||
elif "User-Agent" not in options["headers"]:
|
||||
options["headers"]["User-Agent"] = util.DEFAULT_USER_AGENT
|
||||
|
||||
options["headers"]["Accept-Language"] = "en-US,en;q=0.9"
|
||||
options["headers"]["Sec-Fetch-Site"] = "same-origin"
|
||||
options["headers"]["Accept"] = "*/*"
|
||||
options["headers"][
|
||||
"Content-Type"
|
||||
] = "application/x-www-form-urlencoded; charset=UTF-8"
|
||||
options["headers"]["sec-fetch-mode"] = "cors"
|
||||
|
||||
if "site" in options:
|
||||
options["headers"]["Origin"] = options["surl"]
|
||||
options["headers"][
|
||||
"Referer"
|
||||
] = f"{options['surl']}/v2/{options['pkey']}/1.5.5/enforcement.fbfc14b0d793c6ef8359e0e4b4a91f67.html"
|
||||
|
||||
ua = options["headers"].get("User-Agent")
|
||||
|
||||
data = util.constructFormData(
|
||||
{
|
||||
"bda": util.getBda(ua, options),
|
||||
"public_key": options["pkey"],
|
||||
"site": options["site"] if "site" in options else None,
|
||||
"userbrowser": ua,
|
||||
"capi_version": "1.5.5",
|
||||
"capi_mode": "inline",
|
||||
"style_theme": "default",
|
||||
"rnd": str(random.random()),
|
||||
**{f"data[{k}]": v for k, v in options["data"].items()},
|
||||
"language": options.get("language", "en"),
|
||||
}
|
||||
)
|
||||
|
||||
args = {
|
||||
"url": f"{options['surl']}/fc/gt2/public_key/{options['pkey']}",
|
||||
"headers": options["headers"],
|
||||
"data": data,
|
||||
}
|
||||
return args
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
opt = {
|
||||
"pkey": "3D86FBBA-9D22-402A-B512-3420086BA6CC",
|
||||
"surl": "https://tcr9i.chat.openai.com",
|
||||
"headers": {
|
||||
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0"
|
||||
},
|
||||
"site": "https://chat.openai.com",
|
||||
}
|
||||
|
||||
print(get_values_for_request(opt))
|
Loading…
Add table
Add a link
Reference in a new issue