Explorar o código

beating the bugs

Jason hai 1 ano
pai
achega
b0fdefb4ba
Modificáronse 2 ficheiros con 6 adicións e 5 borrados
  1. 4 3
      website_clickjobs/type-V/_execute.py
  2. 2 2
      website_clickjobs/type-V/c1.py

+ 4 - 3
website_clickjobs/type-V/_execute.py

@@ -22,7 +22,7 @@ path_z = 'C:/ChromeDriver' #pls adjust
 def restart_browser():
     options = webdriver.ChromeOptions()
     #options.add_argument("user-agent=%s" % rua())
-    options.add_argument('--headless')
+    #options.add_argument('--headless')
     options.add_argument('--incognito')
     options.add_argument('--no-sandbox')
     driver=webdriver.Chrome(options=options)
@@ -61,7 +61,8 @@ def process_one(term, tgt, n, sr, se):
         
         for elmt in elmts:
             try:
-                href=elmt.find_element(By.TAG_NAME,"a").get_attribute('href')
+                h1=elmt.find_element(By.TAG_NAME,"a")
+                href=h1.get_attribute('href')
                 datadict['搜尋詞'].append(term)
                 datadict['結果標題'].append(elmt.text)
                 datadict['結果網址'].append(href)
@@ -72,7 +73,7 @@ def process_one(term, tgt, n, sr, se):
 
                 if (n==1 or n==2) and href in tgt:
                     found=1
-                    clickelmt = elmt
+                    clickelmt = h1
                     resultrank = str(cnt)
                     resultlink = href
                     resultttl = elmt.text

+ 2 - 2
website_clickjobs/type-V/c1.py

@@ -19,10 +19,10 @@ def pickvideo():
 
 termlist = ["信義房屋","信義 房屋","信義房仲","信義 房仲"]
 
-clickvideo = 0 # set to 1 to alert if video is found (DOES NOT CLICK!), requires whitelist
+clickvideo = 2 # set to 1 to alert if video is found (DOES NOT CLICK!), requires whitelist
 # ^ set to 2 to click the video when found, requires whitelist
 # ^ any other value will only search for videos based on termlist
-savefile = 1 # set to 1 to save screenshot and ranking to file
+savefile = 0 # set to 1 to save screenshot and ranking to file
 sec = 1
 
 if clickvideo == 1 or clickvideo == 2: