stevekrouse-datemerss.web.val.run
Readme

Date Me Directory RSS Feed

An RSS feed for the https://dateme.directory.

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
import { dataToRSS } from "https://esm.town/v/stevekrouse/dataToRSS";
import { zip } from "npm:lodash-es";
export async function dateMeRSS(req: Request) {
let { columns, rows } = await sqlite.execute(`select * from datemedocs order by LastUpdated desc limit 20`);
const profiles = rows.map(row =>
Object.fromEntries(zip(
columns,
row.map(d => {
try {
return JSON.parse(d);
} catch (_) {
return d;
}
}),
))
);
let data = profiles.map((p) => {
let { Name, Profile, LastUpdated, ...rest } = p;
return {
title: Name,
link: Profile,
pubDate: new Date(LastUpdated),
description: Object.entries(rest).filter(([, v]) => v).map(([k, v]) => k + ": " + v).join(
"\n ",
),
};
}).sort((a, b) => b.pubDate.getTime() - a.pubDate.getTime());
return new Response(
dataToRSS(data, {
title: "Date Me Directory RSS",
link: "https://dateme.directory",
rssLink: "https://dateme.directory/rss.xml",
}),
{
headers: {
"Content-type": "application/rss+xml",
},
},
);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
April 5, 2024