My agentic slop goes here. Not intended for anyone else!
1let sources =
2 River.
3 [
4 { name = "KC Sivaramakrishnan"; url = "http://kcsrk.info/atom-ocaml.xml" };
5 {
6 name = "Amir Chaudhry";
7 url = "http://amirchaudhry.com/tags/ocamllabs-atom.xml";
8 };
9 ]
10
11let main env =
12 (* Use River.with_session for proper resource management *)
13 River.with_session env @@ fun session ->
14 let feeds = List.map (River.fetch session) sources in
15 let posts = River.posts feeds in
16 let entries = River.create_atom_entries posts in
17 let feed =
18 let authors = [ Syndic.Atom.author "OCaml Blog" ] in
19 let id = Uri.of_string "https://ocaml.org/atom.xml" in
20 let links = [ Syndic.Atom.link ~rel:Self id ] in
21 let title : Syndic.Atom.text_construct =
22 Text "OCaml Blog: Read the latest OCaml news from the community."
23 in
24 let updated = Ptime.of_float_s (Unix.gettimeofday ()) |> Option.get in
25 Syndic.Atom.feed ~authors ~links ~id ~title ~updated entries
26 in
27 let out_channel = open_out "example/atom.xml" in
28 Syndic.Atom.output feed (`Channel out_channel);
29 close_out out_channel
30
31let () =
32 Printexc.record_backtrace true;
33 Eio_main.run @@ fun env ->
34 main env