feat(mls): 과거 30일 백필 — 주말 위주 편성으로 일정판에 생기던 공백 해소
야구식 recheck 윈도우(3일)만으론 MLS 직전 라운드(1~2주 전)가 수집되지 않아 일정판이 비고 자체 DB 폼 데이터도 부족했음. 범위를 넓혀도 scoreboard 1콜. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
e1b85aeba6
commit
eecc9829b4
@ -100,6 +100,10 @@ class Settings(BaseSettings):
|
|||||||
# ESPN 비공식 API (MLS 일정·결과·순위·상세) — 키 불필요, 비공식.
|
# ESPN 비공식 API (MLS 일정·결과·순위·상세) — 키 불필요, 비공식.
|
||||||
espn_api_base: str = "https://site.api.espn.com/apis"
|
espn_api_base: str = "https://site.api.espn.com/apis"
|
||||||
espn_mls_path: str = "sports/soccer/usa.1"
|
espn_mls_path: str = "sports/soccer/usa.1"
|
||||||
|
# MLS 과거 경기 백필 일수 — MLS 는 주말 위주 편성이라 야구식 recheck 윈도우(3일)만으론
|
||||||
|
# 일정판에 긴 공백이 생기고 자체 DB 폼 데이터도 비어서, 최근 한 달을 함께 수집한다.
|
||||||
|
# (범위를 넓혀도 scoreboard 1콜, sync 는 추가형이라 과거 경기 재수집 무해)
|
||||||
|
mls_days_back: int = 30
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def league_list(self) -> list[str]:
|
def league_list(self) -> list[str]:
|
||||||
|
|||||||
@ -110,8 +110,9 @@ async def fetch_mls_schedule() -> list[dict]:
|
|||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
today = datetime.now(KST).date()
|
today = datetime.now(KST).date()
|
||||||
# ESPN dates 는 미국 동부 날짜 — KST 범위를 놓치지 않게 시작을 하루 더 당긴다.
|
# 시작 = 백필 윈도우(주말 위주 편성 공백 방지). ESPN dates 는 미국 동부 날짜라
|
||||||
start = today - timedelta(days=settings.result_recheck_days + 1)
|
# KST 범위를 놓치지 않게 하루 여유를 둔다.
|
||||||
|
start = today - timedelta(days=settings.mls_days_back + 1)
|
||||||
end = today + timedelta(days=settings.baseball_days_ahead)
|
end = today + timedelta(days=settings.baseball_days_ahead)
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(timeout=20) as c:
|
async with httpx.AsyncClient(timeout=20) as c:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user