jason hace 2 años
padre
commit
c6b9aca4e8
Se han modificado 1 ficheros con 7 adiciones y 6 borrados
  1. 7 6
      website_clickjobs/_clickjob.py

+ 7 - 6
website_clickjobs/_clickjob.py

@@ -17,7 +17,7 @@ import traceback
 import sys
 from selenium.webdriver.common.keys import Keys
 
-add_tabs = [0,0,1,2,0,3,4,0,1,2,0,3,4,0,1,2,0,3,4,0]
+add_tabs = [4,5,6,7,8,4,5,6,7,8,4,5,6,7,8,4,5,6,7,8]
 
 db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
 driver=None
@@ -80,7 +80,7 @@ def process_query(domain, target_domain, brands, query):
                 print(txt)
                 webdriver.ActionChains(driver).move_to_element(el).perform()
                 webdriver.ActionChains(driver).move_to_element(el).click().perform()
-                time.sleep(6)
+                time.sleep(15)
 
                 new_windows_count = add_tabs[random.randint(0,19)]
                 print(str(new_windows_count) + " new tabs")
@@ -88,8 +88,8 @@ def process_query(domain, target_domain, brands, query):
                     original_window = driver.current_window_handle
                     driver.switch_to.new_window('window')
                     driver.get(href)
-                    sleepoffset += 4
-                    time.sleep(6)
+                    sleepoffset += 12
+                    time.sleep(15)
                     driver.close()
                     driver.switch_to.window(original_window)
 
@@ -138,6 +138,7 @@ def execute(domain, target_domain, brands, query_list):
             run_once(domain, target_domain, brands, random.choice(query_list))
         except:
             traceback.print_exc()
-        sleepint=random.randint(75,110) - sleepoffset
+        sleepint=random.randint(75,90) - sleepoffset
         print("Completed (" + str(sleepint) + ")")
-        time.sleep(sleepint)
+        if sleepint > 0:
+            time.sleep(sleepint)