|  |  | @ -60,16 +60,18 @@ def find_indicate(url): | 
			
		
	
		
		
			
				
					
					|  |  |  | def find_cpi(url): |  |  |  | def find_cpi(url): | 
			
		
	
		
		
			
				
					
					|  |  |  |     from selenium import webdriver |  |  |  |     from selenium import webdriver | 
			
		
	
		
		
			
				
					
					|  |  |  |     from selenium.webdriver.common.by import By |  |  |  |     from selenium.webdriver.common.by import By | 
			
		
	
		
		
			
				
					
					|  |  |  |     from selenium.webdriver.chrome.options import Options |  |  |  |     from selenium.webdriver.firefox.options import Options | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     from selenium.webdriver.support.ui import WebDriverWait |  |  |  |     from selenium.webdriver.support.ui import WebDriverWait | 
			
		
	
		
		
			
				
					
					|  |  |  |     from selenium.webdriver.support import expected_conditions as EC |  |  |  |     from selenium.webdriver.support import expected_conditions as EC | 
			
		
	
		
		
			
				
					
					|  |  |  |     import time |  |  |  |     import time | 
			
		
	
		
		
			
				
					
					|  |  |  |     # options.add_argument("--headless")  # 啟用無頭模式 |  |  |  |     options = Options() | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     driver = webdriver.Edge() |  |  |  |     options.add_argument("--headless")  # 啟用無頭模式 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     driver = webdriver.Firefox(options = options) | 
			
		
	
		
		
			
				
					
					|  |  |  |     driver.get(url) |  |  |  |     driver.get(url) | 
			
		
	
		
		
			
				
					
					|  |  |  |     # time.sleep(3) |  |  |  |     # time.sleep(3) | 
			
		
	
		
		
			
				
					
					|  |  |  |     date = driver.find_element(By.XPATH, '//*[@id="bodytext"]/div[1]/pre[1]').text.split('\n')[6].split("-")[1].split(" ")[1] |  |  |  |     date = driver.find_element(By.XPATH, '//*[@id="bodytext"]/div[1]/pre[1]').text.split('\n')[6].split("-")[1].split(" ")[1] | 
			
		
	
		
		
			
				
					
					|  |  |  |     value = driver.find_element(By.XPATH, '//*[@id="bodytext"]/div[1]/pre[1]').text.split('\n')[8:12] |  |  |  |     value = driver.find_element(By.XPATH, '//*[@id="bodytext"]/div[1]/pre[1]').text.split('\n')[8:12] | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     driver.quit() | 
			
		
	
		
		
			
				
					
					|  |  |  |     return date , value |  |  |  |     return date , value | 
			
		
	
		
		
			
				
					
					|  |  |  | # 是一個持續運行的迴圈,不斷從Telegram伺服器抓取新的消息 |  |  |  | # 是一個持續運行的迴圈,不斷從Telegram伺服器抓取新的消息 | 
			
		
	
		
		
			
				
					
					|  |  |  | # 然後使用上面定義的消息處理器來處理這些消息。 |  |  |  | # 然後使用上面定義的消息處理器來處理這些消息。 | 
			
		
	
	
		
		
			
				
					|  |  | @ -168,4 +170,5 @@ if __name__ == "__main__": | 
			
		
	
		
		
			
				
					
					|  |  |  |     #CPI |  |  |  |     #CPI | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     # data, value = find_cpi(cpi_url) |  |  |  |     # data, value = find_cpi(cpi_url) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     # print(data, value) | 
			
		
	
		
		
			
				
					
					|  |  |  |     # read_CPI(cpi_url) |  |  |  |     # read_CPI(cpi_url) |