e
This commit is contained in:
parent
d7c64fdeae
commit
00000d94fc
8 changed files with 38 additions and 33 deletions
|
|
@ -16,7 +16,7 @@ CACHE_FILE = Cache("volo.json", exp=10_800)
|
|||
|
||||
HTML_CACHE = Cache("volo-html.json", exp=86_400)
|
||||
|
||||
BASE_URL = "http://volokit2.com/sport/"
|
||||
BASE_URL = "http://volokit2.com"
|
||||
|
||||
valid_sports = {
|
||||
"boxing": "Boxing",
|
||||
|
|
@ -131,15 +131,26 @@ async def refresh_html_cache(
|
|||
events = {}
|
||||
|
||||
for card in soup.css("#events .table .vevent.theevent"):
|
||||
name = card.css_first(".teamtd.event").text(strip=True)
|
||||
time = card.css_first(".time").text(strip=True)
|
||||
|
||||
if not (href := card.css_first("a").attributes.get("href")):
|
||||
continue
|
||||
|
||||
name_node = card.css_first(".teamtd.event")
|
||||
time_node = card.css_first(".time").text(strip=True)
|
||||
|
||||
if not (name_node and time_node):
|
||||
continue
|
||||
|
||||
name = name_node.text(strip=True)
|
||||
time = time_node.text(strip=True)
|
||||
|
||||
event_sport = valid_sports[sport]
|
||||
event_name = fix_event(name)
|
||||
event_dt = Time.from_only_time(time, now.date(), "UTC")
|
||||
|
||||
event_dt = Time.from_only_time(
|
||||
time,
|
||||
now.date(),
|
||||
timezone="UTC",
|
||||
)
|
||||
|
||||
key = f"[{event_sport}] {event_name} (VOLO)"
|
||||
|
||||
|
|
@ -204,9 +215,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
|
||||
log.info(f'Scraping from "{BASE_URL}"')
|
||||
|
||||
sport_urls = {
|
||||
sport: urljoin(BASE_URL, sport.lower()) for sport in valid_sports.keys()
|
||||
}
|
||||
sport_urls = {sport: urljoin(BASE_URL, f"sport/{sport}") for sport in valid_sports}
|
||||
|
||||
events = await get_events(
|
||||
client,
|
||||
|
|
@ -244,7 +253,7 @@ async def scrape(client: httpx.AsyncClient) -> None:
|
|||
entry = {
|
||||
"url": url,
|
||||
"logo": logo,
|
||||
"base": "http://volokit2.com",
|
||||
"base": BASE_URL,
|
||||
"timestamp": ts,
|
||||
"id": tvg_id or "Live.Event.us",
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue