05/23 Update new games data
This commit is contained in:
+23
-7
@@ -280,19 +280,35 @@ def _fetch_va_lottery(game_name: str, source: str, url: str) -> dict:
|
||||
continue
|
||||
|
||||
try:
|
||||
numbers = [int(n.strip()) for n in parts[1].split(",") if n.strip()]
|
||||
p1 = parts[1].strip()
|
||||
p1_lower = p1.lower()
|
||||
if p1_lower.startswith("day:"):
|
||||
# Old twice-daily format: "Day: N1,...; Night: N1,..."
|
||||
# Use Night draw only for consistency with modern single-draw records
|
||||
if len(parts) >= 3 and "night:" in parts[2].lower():
|
||||
night_str = parts[2][parts[2].lower().find("night:") + 6:]
|
||||
numbers = [int(n.strip()) for n in night_str.split(",") if n.strip()]
|
||||
else:
|
||||
continue
|
||||
elif p1_lower.startswith("night:"):
|
||||
# Night-only historical record
|
||||
numbers = [int(n.strip()) for n in p1[p1_lower.find("night:") + 6:].split(",") if n.strip()]
|
||||
else:
|
||||
numbers = [int(n.strip()) for n in p1.split(",") if n.strip()]
|
||||
except ValueError as e:
|
||||
logger.warning("[FETCH] VA %s parse error %r: %s", source, line, e)
|
||||
continue
|
||||
|
||||
bonus = None
|
||||
if len(parts) >= 3:
|
||||
colon = parts[2].rfind(":")
|
||||
if colon >= 0:
|
||||
try:
|
||||
bonus = int(parts[2][colon + 1:].strip())
|
||||
except ValueError:
|
||||
pass
|
||||
p_last = parts[-1].strip()
|
||||
if "night:" not in p_last.lower() and "day:" not in p_last.lower():
|
||||
colon = p_last.rfind(":")
|
||||
if colon >= 0:
|
||||
try:
|
||||
bonus = int(p_last[colon + 1:].strip())
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
result = insert_draw(game_id, draw_date, numbers, bonus=bonus, source=source)
|
||||
if result == "inserted":
|
||||
|
||||
Reference in New Issue
Block a user