package river

  1. Overview
  2. Docs
RSS2 and Atom feed aggregator for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

river-0.4.tbz
sha256=c11a290101c8b80cf3c482bf11f5be2a9de97e8b92d5859e12034358792dec51
sha512=7e53a3c339f2ff018a49026280d0833552b09c44df656633b49ed20a42709d1e559c2a8010c17681f479532d62c728840b71d34e973be6fc6b977f92bed15870

Description

RSS2 and Atom feed aggregator for OCaml

Published: 08 Nov 2024

README

River

RSS2 and Atom feed aggregator for OCaml

Features

  • Performs deduplication.

  • Supports pagination and generating well-formed html prefix snippets.

  • Support for generating aggregate feeds.

  • Sorts the posts from most recent to oldest.

  • Depends on Lambda Soup for html parsing.

Installation

opam install river

Usage

Here's an example program that aggregates the feeds from different sources:

let sources =
  River.
    [
      { name = "KC Sivaramakrishnan"; url = "http://kcsrk.info/atom-ocaml.xml" };
      {
        name = "Amir Chaudhry";
        url = "http://amirchaudhry.com/tags/ocamllabs-atom.xml";
      };
    ]

let () =
  let feeds = List.map River.fetch sources in
  let posts = River.posts feeds in
  let entries = River.create_atom_entries posts in
  let feed =
    let authors = [ Syndic.Atom.author "OCaml Blog" ] in
    let id = Uri.of_string "https://ocaml.org/atom.xml" in
    let links = [ Syndic.Atom.link ~rel:Self id ] in
    let title : Syndic.Atom.text_construct =
      Text "OCaml Blog: Read the latest OCaml news from the community."
    in
    let updated = Ptime.of_float_s (Unix.gettimeofday ()) |> Option.get in
    Syndic.Atom.feed ~authors ~links ~id ~title ~updated entries
  in
  let out_channel = open_out "example/atom.xml" in
  Syndic.Atom.output feed (`Channel out_channel);
  close_out out_channel

Contributing

Take a look at our Contributing Guide.

Dependencies (9)

  1. lambdasoup
  2. lwt
  3. ptime
  4. cohttp-lwt-unix >= "5.0.0"
  5. cohttp-lwt >= "5.0.0"
  6. cohttp >= "5.0.0"
  7. syndic >= "1.5"
  8. dune >= "3.0"
  9. ocaml >= "4.08.0"

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.