WardrikTriggers.Feed (wardrik_triggers v0.1.0-rc.1)

Copy Markdown

Parses RSS and Atom feeds and finds entries not seen before.

{:ok, entries} = WardrikTriggers.Feed.parse(xml)
{new, seen} = WardrikTriggers.Feed.unseen(entries, seen)

Summary

Functions

Parses the entries of an RSS or Atom feed, in feed order.

Appends up to 20 entries to prompt, and a count of the rest.

Returns the entries not in seen, oldest first, and the updated seen.

Types

entry()

@type entry() :: %{
  id: String.t(),
  title: String.t() | nil,
  link: String.t() | nil,
  date: String.t() | nil,
  summary: String.t() | nil
}

Functions

parse(xml)

@spec parse(String.t()) :: {:ok, [entry()]} | {:error, String.t()}

Parses the entries of an RSS or Atom feed, in feed order.

prompt(prompt, entries)

@spec prompt(String.t(), [entry()]) :: String.t()

Appends up to 20 entries to prompt, and a count of the rest.

unseen(entries, seen)

@spec unseen([entry()], [String.t()]) :: {[entry()], [String.t()]}

Returns the entries not in seen, oldest first, and the updated seen.

The updated seen keeps the newest 500 ids.