Skip to content

Rotating proxies in UC MODE #2450

Closed
Closed
@Nathan-Romano

Description

@Nathan-Romano

i wonder if its possible to rotate proxies and auth proxies using uc mode like so. i did research here but found nothing about it.
heres a code using selenium and seleniumwire:

def run_instance(proxy, count):
    while  count < num_instances:
        random_proxy = random.choice(proxy_list)
        try:
            response_proxy_up = requests.get('https://google.com', 
                                                    proxies={'https': f'http://user:pass@{random_proxy}' ,'http': 
                                                                            f'http://user:pass@{random_proxy}'},
                                                    timeout=8)
            response_proxy_up.raise_for_status()
            if response_proxy_up.status_code == 200:
                
                print("Proxy selecionada aleatoriamente:", random_proxy)
                options = {
                    'proxy': {
                        'http': f'http://user:pass@{random_proxy}',
                        'https': f'http://user:pass@{random_proxy}',
                    }
                }

                chrome_options = webdriver.ChromeOptions()
                chrome_options.add_argument("start-maximized")
                chrome_options.add_argument("--disable-blink-features=AutomationControlled")
                chrome_options.add_argument('--detach')
                #chrome_options.add_argument('--headless=new')
                chrome_options.add_experimental_option("detach", True)

                chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
                chrome_options.add_experimental_option("useAutomationExtension", False)
                driver = webdriver.Chrome(seleniumwire_options=options, options=chrome_options)

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModequestionSomeone is looking for answers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions