Liking cljdoc? Tell your friends :D

dk.simongray.podcast.feed.publish

What a host does to a feed: fill in what a producer leaves out, import it from another host or move it away, split a long feed into pages, make the private feed of a subscriber, rewrite the URLs of its files, and serve it.

What a host does to a feed: fill in what a producer leaves out, import
it from another host or move it away, split a long feed into pages, make
the private feed of a subscriber, rewrite the URLs of its files, and
serve it.
raw docstring

for-subscriberclj/s

(for-subscriber feed token)
(for-subscriber feed
                token
                {:keys [with-token-fn own-pred block?]
                 param :token-param
                 :or {param token-param own-pred (constantly true) block? true}
                 :as opts})

The feed as the private feed of the subscriber with the token, with the opts below.

The host makes and keeps the tokens, and serves this feed at a URL with the token. The token can be a hidden text of dk.simongray.wary-fetch.secret, and the feed has it in its URLs as plain text. It goes into the query of the URL of each file that the feed links to, as update-file-urls finds them, so that the transcripts, the chapters and the images reach a subscriber from a server that checks the token, and into each link of the feed to its own documents. Each request then tells who the subscriber is. A URL that isn't an http or https URL gets no token.

The feed is closed to the public, and podcast:block, itunes:block and googleplay:block keep it out of the directories. It names no WebSub hub, since a subscriber would give the URL of the feed to the hub. No standard defines the token of a subscriber, so the query parameter is a choice that the options can replace. The opts are:

  • :token-param, the name of the query parameter, token-param by default
  • :with-token-fn, a function of a URL and the token that gives the URL of the subscriber, for a host that has the token in the path
  • :own-pred, a predicate of a URL, where the URLs that it refuses get no token, e.g. the media files on the server of another company
  • :block?, false for a feed that stays as open as it was
The `feed` as the private feed of the subscriber with the `token`, with
the `opts` below.

The host makes and keeps the tokens, and serves this feed at a URL with
the token. The token can be a hidden text of
dk.simongray.wary-fetch.secret, and the feed has it in its URLs as
plain text. It goes into the query of the URL of each file that the
feed links to, as update-file-urls finds them, so that the transcripts,
the chapters and the images reach a subscriber from a server that checks
the token, and into each link of the feed to its own documents. Each
request then tells who the subscriber is. A URL that isn't an http or
https URL gets no token.

The feed is closed to the public, and podcast:block, itunes:block and
googleplay:block keep it out of the directories. It names no WebSub hub,
since a subscriber would give the URL of the feed to the hub. No
standard defines the token of a subscriber, so the query parameter is a
choice that the options can replace. The `opts` are:

- :token-param, the name of the query parameter, token-param by default
- :with-token-fn, a function of a URL and the token that gives the URL
  of the subscriber, for a host that has the token in the path
- :own-pred, a predicate of a URL, where the URLs that it refuses get no
  token, e.g. the media files on the server of another company
- :block?, false for a feed that stays as open as it was
sourceraw docstring

generatorclj/s

What with-defaults names as the generator of a feed, unless its options give another :generator.

What with-defaults names as the generator of a feed, unless its options
give another :generator.
sourceraw docstring

importedclj/s

(imported feed f)

The feed of a show that moves from another host to yours, with the URL of each file that it links to replaced by what f gives for it, e.g. the URL of your copy.

It throws when the feed is locked, since podcast:locked tells other platforms not to import it, and the owner unlocks it at the old host first. The episodes keep their guids, and one without a guid gets the URL of its enclosure from before the rewrite, which apps know it by. A show without a podcast:guid gets that of the URL in its self link, so that the apps keep knowing it after the move.

The links of the old host go: the self link, the links between the documents of its pages, the WebSub hubs, and a move that the feed declares. Give the result to with-defaults with your URL, and to moved, as the guide shows.

The `feed` of a show that moves from another host to yours, with the URL
of each file that it links to replaced by what `f` gives for it, e.g.
the URL of your copy.

It throws when the feed is locked, since podcast:locked tells other
platforms not to import it, and the owner unlocks it at the old host
first. The episodes keep their guids, and one without a guid gets the
URL of its enclosure from before the rewrite, which apps know it by. A
show without a podcast:guid gets that of the URL in its self link, so
that the apps keep knowing it after the move.

The links of the old host go: the self link, the links between the
documents of its pages, the WebSub hubs, and a move that the feed
declares. Give the result to with-defaults with your URL, and to moved,
as the guide shows.
sourceraw docstring

max-ageclj/s

How many seconds a client or a cache may use the feed of a response before asking again, unless its options give another :max-age.

How many seconds a client or a cache may use the feed of a response
before asking again, unless its options give another :max-age.
sourceraw docstring

movedclj/s

(moved feed url)

The feed with an itunes:new-feed-url that names url as its new URL.

Apple asks for it in the feed at the new URL, while the old URL answers with a 301 redirect there, both for at least four weeks. A host that can't redirect serves the old feed with it instead, which the other apps follow. A googleplay:new-feed-url goes, since Google Podcasts closed in 2024 and no app reads it any more but to follow a move.

The `feed` with an itunes:new-feed-url that names `url` as its new URL.

Apple asks for it in the feed at the new URL, while the old URL answers
with a 301 redirect there, both for at least four weeks. A host that
can't redirect serves the old feed with it instead, which the other apps
follow. A googleplay:new-feed-url goes, since Google Podcasts closed in
2024 and no app reads it any more but to follow a move.
sourceraw docstring

page-sizeclj/s

How many items a document of pages holds, unless its options give another :page-size.

How many items a document of pages holds, unless its options give
another :page-size.
sourceraw docstring

pagesclj/s

(pages feed)
(pages feed {:keys [kind url page-url-fn] :or {kind :paged} :as opts})

The documents that a host serves for feed when it's too long for one document, as RFC 5005 defines them, with the opts below.

Each is a map of :url and :feed, in the order that a reader fetches them. The opts are:

  • :kind, :paged by default, or :archived
  • :page-size, the number of items in a document, page-size by default
  • :url, the URL of the feed, where its first document is, by default the atom:link rel=self of the feed
  • :page-url-fn, a function of a number that gives the URL of that page or archive, by default :url with the query parameter page or archive

The pages of a paged feed, as in section 3 of the RFC, change with each new item. An archived feed, as in section 4, has a subscription document with the newest items, and archives that don't change. A reader fetches each archive once. Pages count from 1, the first page, and archives from 1, the oldest.

The items are in the order of the feed, the newest first. Each document has the channel of the feed, and the links of RFC 5005 in its atom:links. An archive has fh:archive.

The documents that a host serves for `feed` when it's too long for one
document, as RFC 5005 defines them, with the `opts` below.

Each is a map of :url and :feed, in the order that a reader fetches
them. The `opts` are:

- :kind, :paged by default, or :archived
- :page-size, the number of items in a document, page-size by default
- :url, the URL of the feed, where its first document is, by default
  the atom:link rel=self of the feed
- :page-url-fn, a function of a number that gives the URL of that page or
  archive, by default :url with the query parameter page or archive

The pages of a paged feed, as in section 3 of the RFC, change with each
new item. An archived feed, as in section 4, has a subscription document
with the newest items, and archives that don't change. A reader fetches
each archive once. Pages count from 1, the first page, and archives from
1, the oldest.

The items are in the order of the feed, the newest first. Each document
has the channel of the feed, and the links of RFC 5005 in its
atom:links. An archive has fh:archive.
sourceraw docstring

responseclj/s

(response request feed)
(response {:keys [headers] :as request}
          feed
          {:keys [body last-modified content-type]
           age :max-age
           :or {age max-age content-type "application/rss+xml; charset=utf-8"}
           :as opts})

A Ring response to the GET or HEAD request for feed, with the opts below: the XML of the feed with its validators, or a 304 when the request names the copy that it has.

  • :body, the XML of the feed, when you have it already, e.g. from a cache, and else rss/emit writes it
  • :last-modified, the time of the last change, by default the lastBuildDate of the feed, or the pubDate of its newest item
  • :max-age, the seconds of its Cache-Control, max-age by default
  • :content-type, application/rss+xml in UTF-8 by default

The ETag is a digest of the XML, so it changes with the feed. The Link header names the WebSub hubs of the feed and its self link, as WebSub has a publisher do, so a subscriber finds the hub without reading the feed. A 304 has the same headers but the Content-Type.

A Ring response to the GET or HEAD `request` for `feed`, with the `opts`
below: the XML of the feed with its validators, or a 304 when the
request names the copy that it has.

- :body, the XML of the feed, when you have it already, e.g. from a
  cache, and else rss/emit writes it
- :last-modified, the time of the last change, by default the
  lastBuildDate of the feed, or the pubDate of its newest item
- :max-age, the seconds of its Cache-Control, max-age by default
- :content-type, application/rss+xml in UTF-8 by default

The ETag is a digest of the XML, so it changes with the feed. The Link
header names the WebSub hubs of the feed and its self link, as WebSub
has a publisher do, so a subscriber finds the hub without reading the
feed. A 304 has the same headers but the Content-Type.
sourceraw docstring

token-paramclj/s

The name of the query parameter that holds the token of a subscriber, unless the options give another :token-param.

The name of the query parameter that holds the token of a subscriber,
unless the options give another :token-param.
sourceraw docstring

update-file-urlsclj/s

(update-file-urls feed f)

The feed with the URL of each file that it links to replaced by what f gives for it: those of update-media-urls, and the trailers, the transcripts, the chapters files and the images of the channel and of each item, the files that check/files lists.

A value that isn't a string stays as it is. A host uses this, e.g., to point a show that it imports at the copies of all its files.

The `feed` with the URL of each file that it links to replaced by what
`f` gives for it: those of update-media-urls, and the trailers, the
transcripts, the chapters files and the images of the channel and of
each item, the files that check/files lists.

A value that isn't a string stays as it is. A host uses this, e.g., to
point a show that it imports at the copies of all its files.
sourceraw docstring

update-media-urlsclj/s

(update-media-urls feed f)

The feed with the URL of each enclosure, and of each source of an alternate enclosure, replaced by what f gives for it.

A value that isn't a string stays as it is. A host uses this to put a prefix or a token on the URLs of its media files.

The `feed` with the URL of each enclosure, and of each source of an
alternate enclosure, replaced by what `f` gives for it.

A value that isn't a string stays as it is. A host uses this to put a
prefix or a token on the URLs of its media files.
sourceraw docstring

with-defaultsclj/s

(with-defaults feed)
(with-defaults
  feed
  {:keys [url at media-fn] made-by :generator :or {made-by generator} :as opts})

The feed that a producer writes from plain data, with what it leaves out filled in, as the opts below say. Nothing that the feed has is replaced:

  • the atom:link rel=self, with the :url that the feed is served at
  • the podcast:guid of that URL, or of the self link, which must never change once the feed is out
  • lastBuildDate, at the :at of the options, the time of the clock by default
  • generator, the :generator of the options, generator by default
  • the guid of an item, the URL of its enclosure
  • the media type of an enclosure, by the extension of its file
  • the length of an enclosure and the itunes:duration of the item, by the :media-fn of the options, a function of the URL of an enclosure that gives what media/read gave for the file, or nil
The `feed` that a producer writes from plain data, with what it leaves
out filled in, as the `opts` below say. Nothing that the feed has is
replaced:

- the atom:link rel=self, with the :url that the feed is served at
- the podcast:guid of that URL, or of the self link, which must never
  change once the feed is out
- lastBuildDate, at the :at of the options, the time of the clock by
  default
- generator, the :generator of the options, generator by default
- the guid of an item, the URL of its enclosure
- the media type of an enclosure, by the extension of its file
- the length of an enclosure and the itunes:duration of the item, by
  the :media-fn of the options, a function of the URL of an enclosure
  that gives what media/read gave for the file, or nil
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close