zooeytsai 2 rokov pred
rodič
commit
fa62b3c51e
1 zmenil súbory, kde vykonal 3 pridanie a 5 odobranie
  1. 3 5
      INNNews/general_clickbot.py

+ 3 - 5
INNNews/general_clickbot.py

@@ -61,7 +61,7 @@ def process_query(qs):
     send_kw_elmt.send_keys(Keys.ENTER)
     time.sleep(6)
 
-    elmts=driver.find_elements_by_xpath("//div[@class='yuRUbf']/a")
+    elmts=driver.find_elements(By.XPATH,"//div[@class='yuRUbf']/a")
 
     idx=1
     ranking=-1
@@ -85,8 +85,8 @@ def process_query(qs):
         if len(txt)>10:
             if domain in href:
                 print('clicked....')
-                print(href)
-                print(txt)
+                print('點擊網址',href)
+                print('標題',txt)
                 print("ranking", idx)
                 table.insert({'kw':q,'domain':domain,'ranking':idx,'title':txt,'url':href,'dt':datetime.datetime.now()})
                 webdriver.ActionChains(driver).move_to_element(elmt).perform()
@@ -113,7 +113,6 @@ def run_once(q):
     driver.delete_all_cookies()
     driver.set_window_size(1400,1000)
 
-    print('到此')
     process_query(q)
     time.sleep(3)
     driver.quit()
@@ -131,7 +130,6 @@ def run_once(q):
 class JParams(object):
 
   def get(self, kw,domain,port):
-    print('關鍵字',kw)
     run_once( (kw,domain,port)   )