This commit is contained in:
silva guimaraes 2025-06-28 16:49:36 -03:00
parent 1a19376620
commit cd650991bc

View file

@ -85,7 +85,7 @@ type tournament_scrape_context = {
season : int;
name : string;
filter_foreigners : bool;
timezone_offset : int option (* we assumes UTC-3 if None *);
timezone_offset : int option (* assumes UTC-3 if None *);
}
[@@deriving show]
@ -195,7 +195,6 @@ let matches_of_api_events (e : api_events) =
{
injury_time1 = x;
injury_time2 = y;
(* second_half_start_timestamp = z; *)
}
| {
injuryTime1 = None;
@ -216,14 +215,14 @@ let matches_of_api_events (e : api_events) =
})
let fetch_matches ctx =
let g order =
let g order (* "last" for previous matches "next" for future matches *) =
try
sprintf
(* TLS fingerprinting is in place and it's been used to block our requests once
their systems detect we've been abusing their private API.
TLS handshakes can only happen with secure connections using
HTTPS, so using plain HTTP makes it impossoble for that to happen, which they
do accept. *)
HTTPS, so using plain HTTP makes it impossible for that to happen,
which they do generously accept. *)
"http://www.sofascore.com/api/v1/unique-tournament/%d/season/%d/events/%s/0"
ctx.id ctx.season order
|> get |> Yojson.Safe.from_string |> api_events_of_yojson