Your Name 3 年之前
父節點
當前提交
f5425c1496
共有 1 個文件被更改,包括 6 次插入45 次删除
  1. 6 45
      choozmo/proxy_pool.py

+ 6 - 45
choozmo/proxy_pool.py

@@ -13,6 +13,7 @@ from bs4 import BeautifulSoup
 import requests
 import time
 import rpyc
+import schedule
 import sys
 import docker
 
@@ -31,8 +32,7 @@ headers = {
 }
 
 
-while True:
-
+def do_job():
     proxy=["--proxy-server=socks4://65.184.223.253:5678","--proxy-server=socks4://217.79.124.92:5678","--proxy-server=socks4://51.161.82.222:9300","--proxy-server=52.11.2.59:3128","--proxy-server=socks4://139.60.12.6:1088","--proxy-server=socks4://206.126.57.190:5678","--proxy-server=socks4://194.208.93.221:5678","--proxy-server=socks4://192.253.209.65:5678","--proxy-server=socks4://139.60.78.28:5678"]
 
     client = docker.from_env()
@@ -66,50 +66,11 @@ while True:
     driver.quit()
 
 
-
-
-
-
-#option.add_argument("--user-data-dir="+self.userdir+profilepath+"\\")
-options = webdriver.ChromeOptions()
-
-#options.add_argument("--user-data-dir=C:\\Users\\jared\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 7\\")
-
-driver = webdriver.Remote(
-    command_executor='http://127.0.0.1:4444/wd/hub',
-#command_executor='http://192.53.174.202:4444/wd/hub',
-#command_executor='http://172.104.93.163:4444/wd/hub',
- 
-#command_executor='http://dev2.choozmo.com:14444/wd/hub',
-desired_capabilities=options.to_capabilities())
-
-
-proxy=["--proxy-server=52.11.2.59:3128","--proxy-server=socks4://139.60.12.6:1088","--proxy-server=socks4://206.126.57.190:5678","--proxy-server=socks4://194.208.93.221:5678","--proxy-server=socks4://192.253.209.65:5678","--proxy-server=socks4://139.60.78.28:5678"]
-
-
-
-
-
-
+do_job()
+schedule.every(20).minutes.do(do_job)
 
 while True:
+    schedule.run_pending()
+    time.sleep(1)
 
-#    options = webdriver.ChromeOptions()
-    #options.add_argument()
-    #options.add_argument()
-    options.add_argument(random.choice(proxy))
-#    options.add_argument("--proxy-server=socks4://172.87.134.60:5678")
-
-
-    #138.68.6.227
-    options.add_argument('--user-agent="Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 640 XL LTE) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10166"')
 
-    driver = webdriver.Chrome(options=options)
-    driver.set_window_size(1400,1000)
-
-    #desired_capabilities=DesiredCapabilities.CHROME)
-    driver.get('https://www.sparkamplab.com/events/arvr-2021')
-    scrolling(20)
-
-    time.sleep(10)
-    driver.quit()