This commit is contained in:
silva guimaraes 2025-06-28 17:20:12 -03:00
parent cd650991bc
commit 88456e17ca
3 changed files with 11 additions and 12 deletions

View file

@ -146,7 +146,8 @@ let f () =
***\n" ***\n"
in in
let md = let md =
sprintf "%s\n\n```text\n%s\n\nUTC-3/[local time]\n```\n\n%s" header schedules footer sprintf "%s\n\n```text\n%s\n\nUTC-3/[local time]\n```\n\n%s" header
schedules footer
in in
(* print_endline md *) (* print_endline md *)
Rentry.update_page md Rentry.update_page md

View file

@ -139,7 +139,8 @@ module Tournament = struct
t.start_timestamp |> float_of_int |> Unix.gmtime t.start_timestamp |> float_of_int |> Unix.gmtime
in in
sprintf "%02d:%02d/%02d:%02d" ts1.tm_hour ts1.tm_min sprintf "%02d:%02d/%02d:%02d" ts1.tm_hour ts1.tm_min
(mmod (ts2.tm_hour + off) 24) ts2.tm_min) (mmod (ts2.tm_hour + off) 24)
ts2.tm_min)
in in
sprintf "%s | %s x %s" timestamp x.home_team.name x.away_team.name) sprintf "%s | %s x %s" timestamp x.home_team.name x.away_team.name)
|> String.concat "\n" |> String.concat "\n"
@ -153,6 +154,7 @@ end
let ( let* ) = Lwt.bind let ( let* ) = Lwt.bind
(* TODO: handle "resolution fai led: name resolution failed" *)
let get url : string = let get url : string =
let http_get url = let http_get url =
Printf.printf "\r%-90s" url; Printf.printf "\r%-90s" url;
@ -191,11 +193,7 @@ let matches_of_api_events (e : api_events) =
injuryTime2 = y; injuryTime2 = y;
currentPeriodStartTimestamp = _; currentPeriodStartTimestamp = _;
} -> } ->
SecondHalf SecondHalf { injury_time1 = x; injury_time2 = y }
{
injury_time1 = x;
injury_time2 = y;
}
| { | {
injuryTime1 = None; injuryTime1 = None;
injuryTime2 = Some y; injuryTime2 = Some y;

View file

@ -20,7 +20,7 @@ let update_page content =
Cohttp_lwt.Body.of_form Cohttp_lwt.Body.of_form
[ [
("csrfmiddlewaretoken", [ value ]); ("csrfmiddlewaretoken", [ value ]);
("edit_code", [ "foo perro bar caca" ]); ("edit_code", [ "foo perro bar caca" ]); (* TODO: use environmental variables *)
("metadata", [ "ACCESS_RECOMMENDED_THEME=dark" ]); ("metadata", [ "ACCESS_RECOMMENDED_THEME=dark" ]);
("text", [ content ]); ("text", [ content ]);
] ]
@ -31,7 +31,7 @@ let update_page content =
let h0 = init () in let h0 = init () in
let h1 = add h0 "Referer" "https://rentry.org" in let h1 = add h0 "Referer" "https://rentry.org" in
let h2 = add h1 "Content-Type" "application/x-www-form-urlencoded" in let h2 = add h1 "Content-Type" "application/x-www-form-urlencoded" in
let h3 = add h2 "User-Agent" "copabot/v0.1.0" in let h3 = add h2 "User-Agent" "copabot/0.1.0" in
let hname, hvalue = let hname, hvalue =
cookies cookies
|> List.map (fun (x : string * Cookie.Set_cookie_hdr.t) -> |> List.map (fun (x : string * Cookie.Set_cookie_hdr.t) ->