|
|
|
@ -1,13 +1,14 @@
|
|
|
|
|
#!coding: utf-8 |
|
|
|
|
|
|
|
|
|
import os |
|
|
|
|
import zipfile |
|
|
|
|
|
|
|
|
|
from selenium import webdriver |
|
|
|
|
|
|
|
|
|
PROXY_HOST = 'u1.5.tn.16yun.cn' # rotating proxy or host |
|
|
|
|
PROXY_PORT = 6441 # port |
|
|
|
|
PROXY_USER = '16ZJZYVL' # username |
|
|
|
|
PROXY_PASS = '167813' # password |
|
|
|
|
|
|
|
|
|
PROXY_PORT = 6441 # port |
|
|
|
|
PROXY_USER = '16ZJZYVL' # username |
|
|
|
|
PROXY_PASS = '112213' # password |
|
|
|
|
|
|
|
|
|
manifest_json = """ |
|
|
|
|
{ |
|
|
|
@ -72,7 +73,7 @@ def get_chromedriver(use_proxy=False, user_agent=None):
|
|
|
|
|
# 如报错 chrome-extensions |
|
|
|
|
# chrome_options.add_argument("--disable-extensions") |
|
|
|
|
|
|
|
|
|
# 防止被反爬 关闭webdriver flag |
|
|
|
|
# 防止被反爬 关闭 webdriver flag |
|
|
|
|
# chrome_options.add_experimental_option('excludeSwitches', ['enable-automation']) |
|
|
|
|
|
|
|
|
|
if use_proxy: |
|
|
|
@ -89,10 +90,13 @@ def get_chromedriver(use_proxy=False, user_agent=None):
|
|
|
|
|
chrome_options=chrome_options) |
|
|
|
|
return driver |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
|
import time |
|
|
|
|
driver = get_chromedriver(use_proxy=True) |
|
|
|
|
#driver.get('https://www.google.com/search?q=my+ip+address') |
|
|
|
|
driver.implicitly_wait(10) # seconds |
|
|
|
|
driver.get('https://httpbin.org/ip') |
|
|
|
|
time.sleep(10) |
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
main() |
|
|
|
|