|
|
|
@ -87,18 +87,19 @@ def find_pce(date:str): |
|
|
|
|
driver = webdriver.Chrome( options=options) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
print("Successfully accessed the website.") |
|
|
|
|
driver.get(pce_url+date) |
|
|
|
|
print("Successfully accessed the website.") |
|
|
|
|
time.sleep(0.5) |
|
|
|
|
date = driver.find_element(By.XPATH, '//*[@id="home"]/h1').text.split(' ')[4] |
|
|
|
|
value_1 = driver.find_element(By.XPATH, '//*[@id="home"]/div[2]/div/div/p[2]').text |
|
|
|
|
value_2 = driver.find_element(By.XPATH, '//*[@id="home"]/div[2]/div/div/div[1]/table/tbody/tr[13]').text.strip(' ').split(' ')[-1] |
|
|
|
|
return date , value_1 , value_2 |
|
|
|
|
except WebDriverException: |
|
|
|
|
return date, value_1, value_2 |
|
|
|
|
except WebDriverException as e: |
|
|
|
|
print(e) |
|
|
|
|
print("Failed to access the website.") |
|
|
|
|
return None , None , None |
|
|
|
|
finally: |
|
|
|
|
driver.quit() |
|
|
|
|
return None |
|
|
|
|
#非農就業人數 |
|
|
|
|
def find_non_farm(url): |
|
|
|
|
from selenium import webdriver |
|
|
|
|