Last active
March 9, 2020 02:03
-
-
Save kitisak/ae291b647bd53e27982ff375de1d2984 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from selenium import webdriver | |
| CHROME_PATH = "\path\to\chrome\driver" | |
| # https://www.sslproxies.org/ | |
| PROXIES = [ | |
| "1.10.251.190:8080", | |
| "13.94.36.9:1080", | |
| "182.52.238.119:40456", | |
| "52.230.6.90:8080", | |
| "1.10.189.84:35138", | |
| "79.234.181.21:8080" | |
| ] | |
| chrome_options = webdriver.ChromeOptions() | |
| for prox in PROXIES: | |
| chrome_options.add_argument('--proxy-server=%s' % prox) | |
| chrome = webdriver.Chrome(CHROME_PATH, options=chrome_options) | |
| print("--- switched to: %s" % prox) | |
| chrome.get("https://checkip.thaiware.com/") | |
| try: | |
| results = chrome.find_elements_by_css_selector('td.detail.right_col') | |
| print("Result: " + results[0].text + " in " +results[1].text) | |
| except: | |
| print("Fail!!") | |
| finally: | |
| chrome.close() | |
| pass | |
| print("Complete") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment