Developer

Parse RSS API

Universal feed parser for RSS, Atom, and JSON Feed via the host feed-rs crate.

ctx.sdk.parseRss is a universal feed parser that wraps the host’s feed-rs crate, so your applet does not ship its own JS parser. It accepts RSS 2.0, Atom 1.0, and JSON Feed 1.1 and returns a normalized result.

Scope required: parsing:rss

Usage

Fetch the feed bytes with ctx.sdk.http (responseType binary), then hand the body to ctx.sdk.parseRss. Access both inside a method’s run:

const res = await ctx.sdk.http.request({
  url: feed.url,
  method: "GET",
  responseType: "binary",
  signal: ctx.signal,
});
const parsed = await ctx.sdk.parseRss(res.body);
// parsed = { title, link?, description?, entries: ParsedEntry[] }

for (const entry of parsed.entries) {
  await Article.insert({
    id: ctx.uuid(),
    feedId: feed.id,
    title: entry.title,
    link: entry.link,
    pubDate: entry.pub_date,
    contentHtml: entry.content_html,
  });
}

Manifest Configuration

Declare the scope (and http:fetch if you fetch the feed with ctx.sdk.http) in applet.json:

{
  "scopes": ["parsing:rss", "http:fetch"]
}

Notes

  • One parser for three formats: RSS 2.0, Atom 1.0, and JSON Feed 1.1, all normalized to the same result shape.
  • The result is { title, link?, description?, entries: ParsedEntry[] }; each entry carries fields such as title, link, pub_date, and content_html.
  • Pass the raw feed bytes. Fetch with ctx.sdk.http.request({ responseType: "binary" }) so the body comes back as a Uint8Array.
  • Parsing runs natively in the host feed-rs crate, so applets do not bundle a JS feed parser.
  • Future sibling parsers (sdk.parseHtml, sdk.parseMarkdown, sdk.parseCsv, sdk.parseImage) follow the same pattern as core applets need them.