Readme

Bluesky RSS bot

This is a bot that polls an RSS feed for a new item every hour and posts it to Bluesky.

It's split into three parts:

  1. bsky_rss_poll
    • This function runs every hour and polls the provided RSS feed, turns it into XML and runs the check. If there is a new post, it tell rss_to_bskyto post a link (and the title) to Bluesky
  2. latest_rss
    • This is a stored object that keeps the latest object for the poll to test against
  3. rss_to_bsky
    • This function turns the text post into a rich text post and posts it to Bluesky
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { fetch } from "https://esm.town/v/std/fetch";
import { rss_to_bsky } from "https://esm.town/v/jordan/rss_to_bsky";
import { set } from "https://esm.town/v/std/set?v=11";
import { latest_rss as latest_rss2 } from "https://esm.town/v/jordan/latest_rss";
export async function bsky_rss_poll() {
const { parseFeed } = await import("https://deno.land/x/rss/mod.ts");
const res = await fetch("https://v8.dev/blog.atom")
.then(res => res.text())
.then(res => parseFeed(res));
const title = res.entries[0].title.value, url = res.entries[0].id;
const latest_rss = JSON.stringify({ "title": title, "url": url });
if(latest_rss2 !== latest_rss) {
await set("latest_rss", latest_rss);
const post = `${title}
${url} `;
await Promise.all([
rss_to_bsky(post)
]);
}
}
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.