обновление для Кубка России
переделаны все парсеры на ссылки из базы
This commit is contained in:
@@ -2,9 +2,8 @@ import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from services.standings_service import sync_standings
|
||||
from parsers.parser_sources import get_parser_source
|
||||
|
||||
URL_STANDINGS = "https://wfl.rfs.ru/tournament/1061879/tables"
|
||||
SEASON = "2025/2026"
|
||||
|
||||
|
||||
def fetch_html(url: str) -> str:
|
||||
@@ -65,16 +64,22 @@ def parse_standings(html: str) -> list[dict]:
|
||||
return standings
|
||||
|
||||
|
||||
def run_parser_standings() -> None:
|
||||
html = fetch_html(URL_STANDINGS)
|
||||
def run_parser_standings(source_key: str | None = None) -> None:
|
||||
source = get_parser_source(source_key)
|
||||
print(f"[parser_standings] Источник: {source['title']}")
|
||||
print(f"[parser_standings] URL: {source['standings_url']}")
|
||||
|
||||
html = fetch_html(source["standings_url"])
|
||||
standings_rows = parse_standings(html)
|
||||
if standings_rows:
|
||||
sync_standings(
|
||||
season=SEASON,
|
||||
season=source["season"],
|
||||
standings_rows=standings_rows,
|
||||
)
|
||||
|
||||
print(f"[parser_standings] Synced rows: {len(standings_rows)}")
|
||||
else:
|
||||
print("[parser_standings] Строки турнирной таблицы не найдены")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user