root 2 rokov pred
rodič
commit
76fd16b073
2 zmenil súbory, kde vykonal 16 pridanie a 13 odobranie
  1. 13 12
      INNNews/general_clickbot_proxy.py
  2. 3 1
      INNNews/run_sheet_2.py

+ 13 - 12
INNNews/general_clickbot_proxy.py

@@ -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__':

+ 3 - 1
INNNews/run_sheet_2.py

@@ -22,7 +22,7 @@ def run_once(pport, dockername):
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
     lst = []
     
-    cursor = db.query('select term, domain from seo.selected_kw where client not in ("毛怪")')
+    cursor = db.query('select term, domain from seo.selected_kw where client not in ("毛怪","火柴星人")')
     for c in cursor:
         lst.append([c['term'], c['domain']])
     
@@ -70,10 +70,12 @@ class JParams(object):
                 os.system('docker container restart tiny2')
                 os.system('docker container restart tiny3')
                 os.system('docker container restart tiny8')
+                #os.system('docker container restart tiny10')
                 time.sleep(1)
                 run_once(9922, 'tiny1')
                 run_once(9923, 'tiny2')
                 run_once(9924, 'tiny3')
+                #run_once(9930, 'tiny10')  
                 run_specific(9929, 'tiny8')
                 time.sleep(20)
                 break