diff --git a/cursed.coco b/cursed.coco index 82a9612..67e563e 100644 --- a/cursed.coco +++ b/cursed.coco @@ -1,5 +1,6 @@ import requests import os +import sys # substrings in path to exclude EXCLUDES = [ @@ -19,6 +20,10 @@ def include_path(path: str) -> bool: return not any([x in path for x in EXCLUDES]) if __name__ == "__main__": + output_file = "out/status.txt" + print(f"writing to file `{output_file}`...") + sys.stdout = open(output_file, "w") + filtered_paths = read_lines("out/cgi-paths.txt") |> map$(parse_path) |> filter$(include_path) |> list print("----- TOM -----") @@ -30,3 +35,7 @@ if __name__ == "__main__": tem_paths = filtered_paths |> map$("https://temmie.pvv.ntnu.no/"+.) |> list tem_oks = tem_paths |> map$(requests.get) |> map$(x -> x.ok) |> list zip(tem_oks, tem_paths) |> map$(x -> str(x[0]) + ":\t" + x[1]) |> "\n".join |> print + + sys.stdout.close() + sys.stdout = sys.__stdout__ + print(f"finished writing to file `{output_file}`.")