2023-10-25 14:41:47 +00:00
|
|
|
import schedule
|
|
|
|
import time
|
|
|
|
|
|
|
|
from database.news import insert
|
|
|
|
from datetime import date
|
|
|
|
from news import scrape_news
|
|
|
|
|
|
|
|
def update_news_data():
|
2023-12-04 13:36:22 +00:00
|
|
|
news_data = scrape_news(date.today())
|
|
|
|
insert(news_data)
|
2023-10-25 14:41:47 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
schedule.every().day.at('02:00', 'America/Los_Angeles').do(update_news_data)
|
|
|
|
while True:
|
|
|
|
schedule.run_pending()
|
|
|
|
time.sleep(1)
|