Skip to content
This repository was archived by the owner on Aug 10, 2023. It is now read-only.

Commit 171f213

Browse files
author
Antonio
committed
delete captcha image afterwards
1 parent 40cc3f2 commit 171f213

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/revChatGPT/V1.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def get_arkose_token() -> str:
139139
if not Path("captcha").exists():
140140
Path("captcha").mkdir()
141141

142+
filenames: list[Path] = []
143+
142144
for image in images:
143145
filename = Path("captcha", f"{time.time()}.png")
144146
with open(filename, "wb") as f:
@@ -151,6 +153,7 @@ def get_arkose_token() -> str:
151153
subprocess.call(["xdg-open", filename])
152154
if sys.platform == "win32":
153155
subprocess.call(["start", filename])
156+
filenames.append(filename)
154157

155158
print(f'Captcha instructions: {challenge_details.get("instructions")}')
156159
print(
@@ -159,6 +162,10 @@ def get_arkose_token() -> str:
159162
print("Enter the index of the images that matches the captcha instructions:")
160163
index = int(input())
161164

165+
# Delete the images
166+
for filename in filenames:
167+
filename.unlink()
168+
162169
resp = session.post(
163170
captcha_url + "verify",
164171
json={"session": resp_json.get("session"), "index": index},

0 commit comments

Comments
 (0)