From 9ce2ba343c34b3c0c59ceae6819f3047fa029112 Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Fri, 27 May 2022 13:18:07 +0200 Subject: [PATCH] change api key --- workers/SolveCaptch.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/workers/SolveCaptch.py b/workers/SolveCaptch.py index a26644d..d8f9023 100644 --- a/workers/SolveCaptch.py +++ b/workers/SolveCaptch.py @@ -3,11 +3,11 @@ import logging import random import re import time - import requests CAPCHA_NOT_READY = "CAPCHA_NOT_READY" REGEX_DATA_SITE_KEY = "data-sitekey=[\"a-z0-9A-Z]+" +API_KEY = "d66aaf490d8aa424a5175e1fbd1aadea" class SolveCaptcha: @@ -28,23 +28,23 @@ class SolveCaptcha: if len(data_sitekey) == 1: key_with_comma = data_sitekey[0].split("=")[-1] key = key_with_comma.replace("\"", '') - print("key is : " + key) + self.logger.info("key is : " + key) self.solve_captcha(key, handle_solution_received) def solve_captcha(self, google_key: str, handle_solution_received): self.logger.info("solve_captcha()") - url_get = "http://2captcha.com/in.php?key=e7e3cd0977aba2dab49e0ea052ca58b1&method=userrecaptcha&googlekey={}&pageurl={}".format( - google_key, self.page.url) + url_get = "http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(API_KEY, + google_key, + self.page.url) res = requests.get(url_get) - - print(res.text) + self.logger.info(res.text) results = res.text.split("|") self.captcha_id = results[-1] # wait for 15 seconds time.sleep(15) # get result of the captcha - url_response = "http://2captcha.com/res.php?key=e7e3cd0977aba2dab49e0ea052ca58b1&action=get&id={}".format( - self.captcha_id) + url_response = "http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, + self.captcha_id) solution = CAPCHA_NOT_READY while solution == CAPCHA_NOT_READY: solution_res = requests.get(url_response)