| 
					
				 | 
			
			
				@@ -51,8 +51,9 @@ def process_query(qs): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     idx=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ranking=-1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     print(len(elmts)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#    if len(elmts) <=0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #    driver.save_screenshot('c:/tmp/test.png') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    clicked=False 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for elmt in elmts: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         href=elmt.get_attribute('href') 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,12 +64,18 @@ def process_query(qs): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 print(href) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 print(txt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 print("ranking", idx) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                table.insert({'kw':q,'domain':domain,'ranking':idx,'title':txt,'url':href,'dt':datetime.datetime.now()}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#                table.insert({'kw':q,'domain':domain,'ranking':idx,'title':txt,'url':href,'dt':datetime.datetime.now()}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                clicked=True 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 webdriver.ActionChains(driver).move_to_element(elmt).perform() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 webdriver.ActionChains(driver).move_to_element(elmt).click().perform() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 time.sleep(5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         idx+=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if not clicked: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        print('quit') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        driver.quit() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        os.exit(-1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 def run_once(q): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     global driver 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -114,10 +121,11 @@ class JParams(object): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         run_once( (kw,domain,port)   ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     except: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         print('exception, restarting.....') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        os.system('docker container restart tiny1') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        time.sleep(10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return -1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#        os.system('docker container restart tiny1') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#        time.sleep(10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if __name__ == '__main__': 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   val=fire.Fire(JParams) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |