An open API service indexing awesome lists of open source software.

https://github.com/taga3s/rss-generator

wip
https://github.com/taga3s/rss-generator

deno rss-generator

Last synced: about 2 months ago
JSON representation

wip

Awesome Lists containing this project

README

          

# rss-generator

[![JSR badge](https://jsr.io/badges/@taga3s/rss-generator)](https://jsr.io/@taga3s/rss-generator)

A simple RSS 2.0 feed generator. This project is just for fun and learning
purpose, so the implementation is intentionally minimal.

## features

- Generates RSS 2.0 feed (following the
[RSS 2.0 Specification](https://www.rssboard.org/rss-specification))
- Zero dependencies

## example usage

```ts
import {
cdata,
type Channel,
generateRSS,
type Item,
} from "jsr:@taga3s/rss-generator";

const items: Item[] = [
{
title: "Example Title 1",
description: cdata("Example description"),
content: {
encoded: cdata("

Example content

"),
},
link: "https://example.com/articles/1",
atom: {
link: {
href: "https://example.com/rss.xml",
},
},
guid: {
isPermaLink: true,
value: "https://example.com/articles/1",
},
pubDate: new Date().toUTCString(),
},
{
title: "Example Title 2",
description: cdata("Example description"),
content: {
encoded: cdata("

Example content

"),
},
link: "https://example.com/articles/2",
guid: {
isPermaLink: true,
value: "https://example.com/articles/2",
},
pubDate: new Date().toUTCString(),
},
];

const channel: Channel = {
title: "Example Web",
link: "https://example.com",
description: cdata("Example description"),
ttl: 60,
language: "en",
category: ["sports", "politics", "technology"],
copyright: "Example Web",
items: items,
};

if (import.meta.main) {
const xml = generateRSS({ channel });
const data = new TextEncoder().encode(xml);
await Deno.writeFile("rss.xml", data);
}
```

Generated RSS file

```xml


Example Web

https://example.com

sports
politics
technology
Example Web
en
60

Example Title 1

Example content]]>
https://example.com/articles/1
John Doe
https://example.com/articles/1
Wed, 14 Jan 2026 01:21:54 GMT


Example Title 2

Example content]]>
https://example.com/articles/2
John Doe
https://example.com/articles/2
Wed, 14 Jan 2026 01:21:54 GMT

```

> [!NOTE]
> You can validate the generated RSS file by using
> [W3C Feed Validation Service](https://validator.w3.org/feed/).

## license

[MIT](https://github.com/taga3s/rss-generator/blob/main/LICENSE)

## author

- [taga3s](https://github.com/taga3s)