|
@@ -59,7 +59,7 @@ def process_query(qs):
|
|
|
time.sleep(3)
|
|
|
send_kw_elmt.send_keys(Keys.ENTER)
|
|
|
time.sleep(6)
|
|
|
-
|
|
|
+ print(driver.current_url)
|
|
|
elmts=driver.find_elements(By.XPATH,"//div[@class='yuRUbf']/a")
|
|
|
|
|
|
idx=1
|
|
@@ -102,18 +102,17 @@ def run_once(q):
|
|
|
options = webdriver.ChromeOptions()
|
|
|
options.add_argument('--headless')
|
|
|
options.add_argument('--remote-debugging-port=9222')
|
|
|
- options.add_experimental_option("debuggerAddress", f"127.0.0.1:{q[2]}")
|
|
|
+ options.add_experimental_option("debuggerAddress", "127.0.0.1:9922")
|
|
|
# options.add_argument("--user-agent=" +user_agent)
|
|
|
options.add_argument("--incognito")
|
|
|
- if 'sorry' in driver.current_url:
|
|
|
- r = redis.Redis(host='db.ptt.cx', port=6379, db=2,password='choozmo9')
|
|
|
- data=r.get('google_proxy')
|
|
|
- jstext=data.decode('utf-8')
|
|
|
- jsobj=json.loads(jstext)
|
|
|
- print('Free proxy',jsobj)
|
|
|
- proxy=random.choice(jsobj)
|
|
|
- change_ip = ["'--proxy-server='+proxy","--proxy-server=socks5://127.0.0.1:9050","--proxy-server=socks5://192.53.174.202:8180"]
|
|
|
- options.add_argument(random.choice(change_ip))
|
|
|
+ r = redis.Redis(host='db.ptt.cx', port=6379, db=2,password='choozmo9')
|
|
|
+ data=r.get('google_proxy')
|
|
|
+ jstext=data.decode('utf-8')
|
|
|
+ jsobj=json.loads(jstext)
|
|
|
+ proxy=random.choice(jsobj)
|
|
|
+ print('Freeproxy',proxy)
|
|
|
+ change_ip = ["'--proxy-server='+proxy","--proxy-server=socks5://127.0.0.1:9050","--proxy-server=socks5://192.53.174.202:8180"]
|
|
|
+ options.add_argument('--proxy-server=socks5://192.53.174.202:8180')
|
|
|
driver = webdriver.Chrome(
|
|
|
options=options,service=s)
|
|
|
|
|
@@ -137,7 +136,9 @@ def run_once(q):
|
|
|
class JParams(object):
|
|
|
|
|
|
def get(self, kw,domain,port):
|
|
|
- run_once( (kw,domain,port) )
|
|
|
+ os.system('docker container restart tiny1')
|
|
|
+ time.sleep(1)
|
|
|
+ run_once( ('台北 禮儀 社','sctt.com.tw','tiny1') )
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|