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