Skip to content

Commit

Permalink
maybe proxy error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
InvalidAccount committed Oct 23, 2022
1 parent c0653f0 commit 7146c34
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

## 📝 Document

### Use Http proxies
### Before Run [Check Here](#config_doc)


**Install Requirements**

```
Expand Down
17 changes: 3 additions & 14 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
from PyTerm import Console
from colorama import Fore
from selenium import webdriver
from selenium.webdriver import Proxy
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.proxy import ProxyType
from selenium.webdriver.support.select import Select
from tqdm import tqdm
from twocaptcha import TwoCaptcha
Expand Down Expand Up @@ -56,15 +54,6 @@ def __init__(self):
self.options.add_experimental_option('excludeSwitches', ['enable-logging'])
self.options.add_experimental_option('useAutomationExtension', False)

@staticmethod
def create_proxy(proxy: str):
# Make Proxy Function
proxy_core = Proxy()
proxy_core.proxyType = ProxyType.MANUAL
proxy_core.httpProxy = proxy
proxy_core.sslProxy = proxy
return proxy_core

def solver(self, site_url, browser):
# Solve Captcha Function
global solvedCaptcha
Expand All @@ -75,7 +64,7 @@ def solver(self, site_url, browser):
except Exception as exp:
self.print(exp)

# AnyCaptcha
# AnyCaptcha
elif self.providers == 'anycaptcha':
client = anycaptcha.AnycaptchaClient(self.api_key)
task = anycaptcha.FunCaptchaProxylessTask(site_url, self.site_key)
Expand All @@ -90,6 +79,7 @@ def solver(self, site_url, browser):
solvedCaptcha += 1
return result


def fElement(self, driver: WebDriver, by: By = By.ID, value=None, delay: float = 0.3):
# Custom find Element Function
count = 0
Expand Down Expand Up @@ -223,8 +213,7 @@ def run(self):
self.generate_info()
proxy = choice(self.proxies) # Select Proxy
self.print(proxy)
self.capabilities = webdriver.DesiredCapabilities.CHROME # Driver Capabilities
self.create_proxy(proxy).add_to_capabilities(self.capabilities)
self.options.add_argument("--proxy-server=http://%s" % proxy)
self.CreateEmail(driver=webdriver.Chrome(options=self.options, desired_capabilities=self.capabilities))


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
git+https://github.com/Its-Vichy/PyTerm.git
selenium==4.4.3
selenium==4.5.0
six~=1.16.0
requests~=2.28.1
unique-names-generator~=1.0.2
Expand Down

0 comments on commit 7146c34

Please sign in to comment.