Compare commits
2 Commits
18bac0d12d
...
21e37a1097
| Author | SHA1 | Date | |
|---|---|---|---|
| 21e37a1097 | |||
| 801936518a |
@@ -200,27 +200,28 @@ def run_parser_game(match_external_id: str) -> None:
|
||||
url = f"{BASE_MATCH_URL}{str(match_external_id).strip()}"
|
||||
html = fetch_html(url)
|
||||
data = parse_game_page(html)
|
||||
|
||||
if data:
|
||||
sync_match_page(
|
||||
match_external_id=str(match_external_id).strip(),
|
||||
home_starting=data["home_starting"],
|
||||
away_starting=data["away_starting"],
|
||||
home_bench=data["home_bench"],
|
||||
away_bench=data["away_bench"],
|
||||
home_coaches=data["home_coaches"],
|
||||
away_coaches=data["away_coaches"],
|
||||
referees=data["referees"],
|
||||
)
|
||||
|
||||
sync_match_page(
|
||||
match_external_id=str(match_external_id).strip(),
|
||||
home_starting=data["home_starting"],
|
||||
away_starting=data["away_starting"],
|
||||
home_bench=data["home_bench"],
|
||||
away_bench=data["away_bench"],
|
||||
home_coaches=data["home_coaches"],
|
||||
away_coaches=data["away_coaches"],
|
||||
referees=data["referees"],
|
||||
)
|
||||
|
||||
print(
|
||||
f"[parser_game] match={match_external_id} "
|
||||
f"home_starting={len(data['home_starting'])} "
|
||||
f"away_starting={len(data['away_starting'])} "
|
||||
f"home_bench={len(data['home_bench'])} "
|
||||
f"away_bench={len(data['away_bench'])} "
|
||||
f"home_coaches={len(data['home_coaches'])} "
|
||||
f"away_coaches={len(data['away_coaches'])} "
|
||||
f"referees={len(data['referees'])}"
|
||||
)
|
||||
print(
|
||||
f"[parser_game] match={match_external_id} "
|
||||
f"home_starting={len(data['home_starting'])} "
|
||||
f"away_starting={len(data['away_starting'])} "
|
||||
f"home_bench={len(data['home_bench'])} "
|
||||
f"away_bench={len(data['away_bench'])} "
|
||||
f"home_coaches={len(data['home_coaches'])} "
|
||||
f"away_coaches={len(data['away_coaches'])} "
|
||||
f"referees={len(data['referees'])}"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -165,8 +165,9 @@ def parse_schedule(html: str) -> list[dict]:
|
||||
def run_parser_schedule() -> None:
|
||||
html = fetch_html(URL_SCHEDULE)
|
||||
matches_data = parse_schedule(html)
|
||||
sync_matches(matches_data)
|
||||
print(f"[parser_schedule] Matches synced: {len(matches_data)}")
|
||||
if matches_data:
|
||||
sync_matches(matches_data)
|
||||
print(f"[parser_schedule] Matches synced: {len(matches_data)}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -68,13 +68,13 @@ def parse_standings(html: str) -> list[dict]:
|
||||
def run_parser_standings() -> None:
|
||||
html = fetch_html(URL_STANDINGS)
|
||||
standings_rows = parse_standings(html)
|
||||
if standings_rows:
|
||||
sync_standings(
|
||||
season=SEASON,
|
||||
standings_rows=standings_rows,
|
||||
)
|
||||
|
||||
sync_standings(
|
||||
season=SEASON,
|
||||
standings_rows=standings_rows,
|
||||
)
|
||||
|
||||
print(f"[parser_standings] Synced rows: {len(standings_rows)}")
|
||||
print(f"[parser_standings] Synced rows: {len(standings_rows)}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -80,8 +80,9 @@ def parse_teams_html(html: str) -> dict:
|
||||
|
||||
def run_parser_teams() -> None:
|
||||
teams_data = get_url_teams()
|
||||
sync_teams(teams_data)
|
||||
print(f"Teams synced: {len(teams_data)}")
|
||||
if teams_data:
|
||||
sync_teams(teams_data)
|
||||
print(f"Teams synced: {len(teams_data)}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user