|
|
|
@ -93,15 +93,19 @@ def find_cpi(url): |
|
|
|
|
import time |
|
|
|
|
print("Start") |
|
|
|
|
options = Options() |
|
|
|
|
# options.add_argument('--headless') |
|
|
|
|
options.add_argument('--headless') |
|
|
|
|
options.add_argument('--no-sandbox') |
|
|
|
|
options.add_argument('--disable-dev-shm-usage') |
|
|
|
|
options.add_argument("--window-size=1920,1080") # 可以根據需要調整這個大小 |
|
|
|
|
options.add_argument( |
|
|
|
|
'user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3') |
|
|
|
|
driver = webdriver.Chrome( options=options) |
|
|
|
|
driver.get(url) |
|
|
|
|
# time.sleep(3) |
|
|
|
|
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] |
|
|
|
|
driver.quit() |
|
|
|
|
print("Open") |
|
|
|
|
# time.sleep(4) |
|
|
|
|
date = driver.find_element(By.XPATH, '/html/body/div[2]/div[5]/div/div[1]/pre[1]').text.split('\n')[6].split("-")[1].split(" ")[1] |
|
|
|
|
value = driver.find_element(By.XPATH, '/html/body/div[2]/div[5]/div/div[1]/pre[1]').text.split('\n')[8:12] |
|
|
|
|
# driver.quit() |
|
|
|
|
return date , value |
|
|
|
|
|
|
|
|
|
def find_fomc(url,date:str): |
|
|
|
|