RSS and Atom deserialization module for Deno.
The project aims to provide a
lightweight and easy-to-use feed deserializer.
Check out the deserializer in this online showcase
import { parseFeed } from "jsr:@mikaelporttila/rss@*";
// Or by using Denoland direct import
// import { parseFeed } from "https://deno.land/x/rss/mod.ts";
const response = await fetch(
"http://static.userland.com/gems/backend/rssTwoExample2.xml",
);
const xml = await response.text();
const feed = await parseFeed(xml);
// Your code...
import {
DublinCore,
MediaRss,
parseFeed,
} from "https://deno.land/x/rss/mod.ts";
const response = await fetch(
"http://static.userland.com/gems/backend/rssTwoExample2.xml",
);
const xml = await response.text();
// Optional destructuring assignment
const { entries } = await parseFeed(xml);
// Access fields using the DublinCore and MediaRss enums
const dcTitle = entries[0][DublinCore.Title];
const mediaContent = entries[0][MediaRss.Content];
Feed | Atom | RSS2 | RSS |
---|---|---|---|
FeedType | Atom | RSS2 | RSS1 |
Id | Id | Link or DC:URI | Link or DC:URI |
Title | Title | Title or DC:Title | Title or DC:Title |
Description | Subtitle | Description or DC:Description | Description or DC:Description |
Links | Links | Link, DC:URI | Link or DC:URI |
Image | Logo | Image | Image |
Icon | Icon | - | - |
Language | N/A | Language or DC:Language | DC:Language |
Created | Updated | LastBuildDate or DC:Created or PubDate or DC:DateSubmitted or DC:Date | DC:Created or DC:DateSubmitted or DC:Date |
Published | Updated | PubDate or DC:DateSubmitted or DC:Date | DC:DateSubmitted or DC:Date |
UpdateDate | Updated | LastBuildDate or DC:Date | DC:Date |
Generator | Generator | Generator | - |
Ttl | - | Ttl | - |
Categories | Category | - | - |
Author | Author | WebMaster or DC:Creator | DC:Creator |
Copyright | - | Copyright or DC:Rights | DC:Rights |
SkipDays | - | SkipDays | - |
SkipHours | - | SkipHours | - |
Docs | - | Docs | - |
Dublin Core Namespace | - | All Dublin Core fields | All Dublin Core fields |
Slash Namespace | - | - | All Slash fields |
Feed | Atom | RSS2 | RSS |
---|---|---|---|
Id | Id | Guid | DC:URI or Link |
Author | Author | Author or DC:Creator | DC:Creator |
Title | Title | Title or DC:Title | Title or DC:Title |
Description | Summary | Description or DC:Description | Description or DC:Description |
Content | Content | Content:Encoded | - |
Links | Links, feedburner:origlink, Href, (Id if URL) | Href | Link, DC:URI |
Attachments | Links (marked as enclosure) | Enclosure | - |
Published | Published | DC:DateSubmitted or PubDate or DC:Date | DC:DateSubmitted or DC:Date |
Updated | Updated | PubDate | DC:DateSubmitted or DC:Date |
Categories | Category | Category | - |
Contributors | Contributors | DC:Contributor | DC:Contributor |
Comments | - | Comments | - |
Source | Source | - | - |
Media Namespace | - | All Media fields | - |
Dublin Core Namespace | - | All Dublin Core fields | All Dublin Core fields |
Slash Namespace | - | - | All Slash fields |
Using Denon
denon start
Using Deno
deno run --allow-read dev.ts atom
Using Denon
denon test
Using Deno
deno test --allow-read
Using Denon
denon benchmark
Using Deno
deno bench --allow-read bench.ts
Using Denon
denon memory
Using Deno
deno run --allow-read dev_memory_usage.ts