The feed model: canonical Hiccup in, maps out, and back again, by a tag registry.
A feed is the channel map itself, with the items under :rss/items and the live items under :podcast/live-items. In the map:
Nothing throws on a bad value, which stays a string, and the report says so. The report is in the metadata of the result under :podcast/report.
The feed model: canonical Hiccup in, maps out, and back again, by a tag registry. A feed is the channel map itself, with the items under :rss/items and the live items under :podcast/live-items. In the map: - a scalar element becomes a coerced scalar - an element with attributes or children becomes a map - a repeatable element becomes a vector - an element that the registry doesn't know stays as Hiccup under :xml/unknown Nothing throws on a bad value, which stays a string, and the report says so. The report is in the metadata of the result under :podcast/report.
(diff before after)What changed from the feed before to the feed after, by item identity:
{:added [item ...] :removed [item ...] :changed [{:before :after} ...]
:renamed [{:before :after} ...]
:unchanged 42
:live-items {:added [...] :removed [...] :changed [...] :unchanged 1}
:channel-changed? false}
Items without an identity, with neither a guid nor an enclosure, aren't compared, and neither are the later of the items that share one. An item that's a removed one under a new guid is :renamed rather than added and removed: one with the same enclosure URL, or else the same title and a date a day apart at most, when only one item on each side matches. The channel counts as changed when anything but its items, live items and timestamps differs.
What changed from the feed `before` to the feed `after`, by item identity:
{:added [item ...] :removed [item ...] :changed [{:before :after} ...]
:renamed [{:before :after} ...]
:unchanged 42
:live-items {:added [...] :removed [...] :changed [...] :unchanged 1}
:channel-changed? false}
Items without an identity, with neither a guid nor an enclosure, aren't
compared, and neither are the later of the items that share one. An
item that's a removed one under a new guid is :renamed rather than added
and removed: one with the same enclosure URL, or else the same title and
a date a day apart at most, when only one item on each side matches. The
channel counts as changed when anything but its items, live items and
timestamps differs.(emit feed)(emit feed {:keys [registry namespaces] :or {registry spec/default} :as opts})The canonical Hiccup document of feed, with the opts below:
It takes the shorthand that a producer can write, and leaves out nil values. The known namespaces, those of :namespaces, and the foreign namespaces recorded when the feed was parsed go along as metadata under :xml/namespaces, for the document to declare.
The canonical Hiccup document of `feed`, with the `opts` below: - :registry, the tag registry, spec/default by default - :namespaces, a map from alias to URI for the elements of namespaces that the feed wasn't parsed with, or for another URI of one that it was It takes the shorthand that a producer can write, and leaves out nil values. The known namespaces, those of :namespaces, and the foreign namespaces recorded when the feed was parsed go along as metadata under :xml/namespaces, for the document to declare.
(join-pages pages)One feed of pages, the parsed pages of a feed that comes in pages, in
their order, or nil for no pages.
The feed is the channel of the first page, with the items of all the pages. A feed can gain items while its pages are read, so an item of a later page is left out when an earlier page has it.
The report has the diagnostics of the first page. From a later page, it has the diagnostics of the items that the feed takes from the page, and the diagnostics without a path. The path of a diagnostic names the item where the feed has it.
One feed of `pages`, the parsed pages of a feed that comes in pages, in their order, or nil for no pages. The feed is the channel of the first page, with the items of all the pages. A feed can gain items while its pages are read, so an item of a later page is left out when an earlier page has it. The report has the diagnostics of the first page. From a later page, it has the diagnostics of the items that the feed takes from the page, and the diagnostics without a path. The path of a diagnostic names the item where the feed has it.
(new-episodes url before after)(new-episodes url
before
after
{:keys [only-newer?] :or {only-newer? true} :as opts})The ids of the episodes that the parse after of the feed at url has
and the parse before hadn't, by the opts below, as a map:
{:added [[feed-guid item-guid] …] ; the new ones, oldest first
:backfilled [[feed-guid item-guid] …] ; older ones that appeared
:renamed [[old-id new-id] …]} ; those under a new guid
An episode is new unless it's older than the newest one of before, so
that a host that publishes its back catalogue again, or rewrites guids
that diff can't pair, adds no old episodes. One without a date is new.
Without before, there are none, since a first parse finds the back
catalogue. The opts are:
The ids of the episodes that the parse `after` of the feed at `url` has
and the parse `before` hadn't, by the `opts` below, as a map:
{:added [[feed-guid item-guid] …] ; the new ones, oldest first
:backfilled [[feed-guid item-guid] …] ; older ones that appeared
:renamed [[old-id new-id] …]} ; those under a new guid
An episode is new unless it's older than the newest one of `before`, so
that a host that publishes its back catalogue again, or rewrites guids
that diff can't pair, adds no old episodes. One without a date is new.
Without `before`, there are none, since a first parse finds the back
catalogue. The `opts` are:
- :only-newer?, false to count every episode that appeared as new(normalize feed)(normalize feed opts)The feed in the shape of the model, by the :registry of opts,
spec/default by default.
It expands the shorthand that a producer can write, e.g.:
{:rss/guid "x"} ; for {:rss/guid {:content "x"}}
{:podcast/transcripts {…}} ; for {:podcast/transcripts [{…}]}
A string where the model takes another type is read as parse reads the text of XML, e.g. a date, a duration such as "30:00" or "no" for false, and its report has :feed/string-value for each. A string that doesn't read stays, so that the validator reports it. A parsed feed comes back unchanged.
The `feed` in the shape of the model, by the :registry of `opts`,
spec/default by default.
It expands the shorthand that a producer can write, e.g.:
{:rss/guid "x"} ; for {:rss/guid {:content "x"}}
{:podcast/transcripts {…}} ; for {:podcast/transcripts [{…}]}
A string where the model takes another type is read as parse reads the
text of XML, e.g. a date, a duration such as "30:00" or "no" for false,
and its report has :feed/string-value for each. A string that doesn't
read stays, so that the validator reports it. A parsed feed comes back
unchanged.(parse tree)(parse tree {:keys [registry] :or {registry spec/default} :as opts})Parse the canonical Hiccup tree of an RSS 2.0 document into a feed map
by the :registry of opts, spec/default by default.
The diagnostics go along as metadata under :podcast/report, and the foreign namespaces that the document used under :xml/namespaces. What resolving the namespaces found stays under :xml/report on the tree. The attributes of rss other than its version, and those of channel, have no place in the model, and the report says when there are any.
Parse the canonical Hiccup `tree` of an RSS 2.0 document into a feed map by the :registry of `opts`, spec/default by default. The diagnostics go along as metadata under :podcast/report, and the foreign namespaces that the document used under :xml/namespaces. What resolving the namespaces found stays under :xml/report on the tree. The attributes of rss other than its version, and those of channel, have no place in the model, and the report says when there are any.
(report feed)The diagnostics recorded while parsing feed, each with its message from
the catalogue of diagnostics.
The diagnostics recorded while parsing `feed`, each with its message from the catalogue of diagnostics.
(supplement item)Where the item of a feed came from when supplemented took it from a
supplement: the URL that the supplement names as its own, or true when
it names none, or else nil.
Where the `item` of a feed came from when supplemented took it from a supplement: the URL that the supplement names as its own, or true when it names none, or else nil.
(supplemented primary supplement)(supplemented primary
supplement
{:keys [max-delay-days] :or {max-delay-days 60} :as opts})The feed primary with the items of the feed supplement that it lacks,
by the opts below, e.g. those of another feed of the same show that
keeps more of its back catalogue or has its episodes sooner.
An item of the supplement is one episode with an item of primary when
they have the same guid, or else the same title and the item of primary
is dated at most a day before it and at most :max-delay-days after, the
nearest first, one item to one. The feed keeps its channel and its own
items, each dated as the supplement dates its episode, so that diff
pairs an item of the supplement with the one that primary later has
for its episode, as a rename. The items are newest first, and those
without a date last. Each item that the feed takes from the supplement
names it, as supplement tells. Without a supplement, primary stays as
it is.
The report has the diagnostics of primary, and those of the items that
the feed takes from the supplement, with paths of where the feed has
them. The opts are:
primary may date
an episode, 60 by defaultThe feed `primary` with the items of the feed `supplement` that it lacks, by the `opts` below, e.g. those of another feed of the same show that keeps more of its back catalogue or has its episodes sooner. An item of the supplement is one episode with an item of `primary` when they have the same guid, or else the same title and the item of `primary` is dated at most a day before it and at most :max-delay-days after, the nearest first, one item to one. The feed keeps its channel and its own items, each dated as the supplement dates its episode, so that diff pairs an item of the supplement with the one that `primary` later has for its episode, as a rename. The items are newest first, and those without a date last. Each item that the feed takes from the supplement names it, as supplement tells. Without a supplement, `primary` stays as it is. The report has the diagnostics of `primary`, and those of the items that the feed takes from the supplement, with paths of where the feed has them. The `opts` are: - :max-delay-days, how much later than the supplement `primary` may date an episode, 60 by default
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |