diff --git a/bin/main.ml b/bin/main.ml index dd4b64a..e19164a 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -76,8 +76,8 @@ let handler data (signal : int) = stop_process data; exit (match signal with - | v when v = Sys.sigint -> 130 - | _ -> 1) + | v when v = Sys.sigint -> 130 + | _ -> 1) ;; let () = @@ -89,12 +89,12 @@ let () = { session_id = snd data ; debug = (match Sys.getenv_opt "PUSK_DEBUG" with - | Some boolean -> if String.lowercase_ascii boolean = "true" then true else false - | None -> false) + | Some boolean -> if String.lowercase_ascii boolean = "true" then true else false + | None -> false) } in if ctx.debug then print_endline "Logging is enabled"; (try main ctx with - | Any why -> print_endline why); + | Any why -> print_endline why); stop data ;; diff --git a/lib/drivers.ml b/lib/drivers.ml index 3b16e4c..7fee1b8 100644 --- a/lib/drivers.ml +++ b/lib/drivers.ml @@ -22,7 +22,7 @@ let rec download uri dest = let stream = Body.to_stream body in let res = Lwt_io.with_file ~mode:Lwt_io.output dest (fun chan -> - Lwt_stream.iter_s (Lwt_io.write chan) stream) + Lwt_stream.iter_s (Lwt_io.write chan) stream) in let* () = res in print_endline "Download done!"; diff --git a/lib/net.ml b/lib/net.ml index f386746..980dbfb 100644 --- a/lib/net.ml +++ b/lib/net.ml @@ -67,12 +67,12 @@ let rec wait_for_load session_id = match Yojson.Safe.from_string response with | `Assoc fields -> (match List.assoc "value" fields with - | `String res -> - if not (res = "complete") - then ( - Unix.sleep 2; - wait_for_load session_id) - | _ -> raise (Any "Error when waiting for page to load")) + | `String res -> + if not (res = "complete") + then ( + Unix.sleep 2; + wait_for_load session_id) + | _ -> raise (Any "Error when waiting for page to load")) | _ -> raise (Any "wait_for_load | Invalid JSON") ;; @@ -90,22 +90,22 @@ let parser response = match Yojson.Safe.from_string response with | `Assoc fields -> (match List.assoc "value" fields with - | `List l -> - List.fold_left - (fun acc x -> - match x with - | `Assoc subfields -> - List.fold_left - (fun acc' (_, value) -> - match value with - | `String str -> str :: acc' - | _ -> acc') - acc - subfields - | _ -> acc) - [] - l - | _ -> []) + | `List l -> + List.fold_left + (fun acc x -> + match x with + | `Assoc subfields -> + List.fold_left + (fun acc' (_, value) -> + match value with + | `String str -> str :: acc' + | _ -> acc') + acc + subfields + | _ -> acc) + [] + l + | _ -> []) | _ -> raise (Any "finder parser | Invalid JSON") ;; @@ -151,9 +151,9 @@ let get_attribute session_id element_id attribute = match Yojson.Safe.from_string response with | `Assoc fields -> (match List.assoc "value" fields with - | `String href -> href - | _ as e -> - raise (Any (fmt "Unexpected response from driver: %s" (Yojson.Safe.to_string e)))) + | `String href -> href + | _ as e -> + raise (Any (fmt "Unexpected response from driver: %s" (Yojson.Safe.to_string e)))) | _ -> raise (Any "get_attribute | Invalid JSON") ;;