diff --git a/gmail_automation.py b/gmail_automation.py index 35af7d8..350bb3b 100644 --- a/gmail_automation.py +++ b/gmail_automation.py @@ -9,6 +9,7 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.chrome.service import Service as ChromeService from selenium.webdriver.chrome.options import Options as ChromeOptions +from webdriver_manager.chrome import ChromeDriverManager import random import time from datetime import datetime, timedelta @@ -19,18 +20,27 @@ def main(): - #proxy = ["ip:port", "ip:port"]#if you want to use a proxy, you can uncomment the next line and put your proxy list, I recommend using a socks5 proxy + #proxy = ["ip:port", "ip:port"] # Provide your proxy list if desired (see normalize_proxy for accepted formats) # Here is a page that can provide you with free proxies: http://free-proxy.cz/en/proxylist/country/all/socks5/ping/all/2 # Chrome options chrome_options = ChromeOptions() chrome_options.add_argument("--disable-infobars") - #chrome_options.add_argument(f'--proxy-server=socks5://{random.choice(proxy)}') # if you want to use a socks5 proxy is for anonimous creation (highly recommended) - #chrome_options.add_argument('--ignore-certificate-errors') # if you use a proxy uncomment this line - # WebDriver service - ChromeService('chromedriver.exe') - driver = webdriver.Chrome(options=chrome_options) + # Configure proxy if provided + selected_proxy = None + try: + if proxy: + selected_proxy = normalize_proxy(random.choice(proxy)) + chrome_options.add_argument(f'--proxy-server={selected_proxy}') + chrome_options.add_argument('--ignore-certificate-errors') + except NameError: + # proxy list not defined; continue without proxy + pass + + # WebDriver service (Selenium Manager + webdriver-manager ensures a matching ChromeDriver) + service = ChromeService(executable_path=ChromeDriverManager().install()) + driver = webdriver.Chrome(service=service, options=chrome_options) #change the names to spanic ones down below you can see the list of french names first_names = [ @@ -232,6 +242,19 @@ def fill_password(driver, wait, your_password): next_button.click() print("Password filled successfully") +#--------------------------------------------------------- proxy helpers ------------------------------------------------------------- +def normalize_proxy(proxy_value, default_scheme="socks5"): + """ + Ensure the proxy string includes a scheme so Selenium/Chrome accept it. + If the scheme is missing, prepend default_scheme (socks5 by default). + """ + if not proxy_value: + return proxy_value + proxy_value = proxy_value.strip() + if "://" in proxy_value: + return proxy_value + return f"{default_scheme}://{proxy_value}" + #--------------------------------------------------------- extra functions ------------------------------------------------------------- def random_birthday(min_age=18, max_age=70): today = datetime.today() diff --git a/readme.md b/readme.md index acf437c..ce0a002 100644 --- a/readme.md +++ b/readme.md @@ -22,7 +22,7 @@ This script allows you to automate the creation of Gmail accounts using the Sele - Python 3.x - ChromeDriver - [Download ChromeDriver](https://sites.google.com/chromium.org/driver/) -- Selenium library - Install using `pip install selenium` +- Python dependencies listed in `requirements.txt` (install with `pip install -r requirements.txt`) ## Usage @@ -34,10 +34,10 @@ This script allows you to automate the creation of Gmail accounts using the Sele 2. Download the ChromeDriver executable and place it in the repository directory. -3. Install the required libraries: +3. Install the required libraries (this will install both `selenium` and `unidecode`): ``` - pip install selenium + pip install -r requirements.txt ``` 4. Open the script (`gmail_automation.py`) and update the `your_first_name`, `your_last_name`, `your_username`, `your_birthday`, `your_gender`, and `your_password` variables with your desired account details. diff --git a/requirements.txt b/requirements.txt index 10f1668..42a31c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ selenium -unidecode \ No newline at end of file +unidecode +webdriver-manager \ No newline at end of file