2025-11-05 20:49:00 -09:00

56 lines
1.6 KiB
Plaintext

<%#
index.ejs — RSS Feed Generator (RSS 2.0)
Expects: data.vods = [{ id, title, notes, thumbnail, streamDate }]
%>
<%
response.header("Content-Type", "application/rss+xml")
// Build RSS XML as a string
let rss = `<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Futureporn.net</title>
<link>https://futureporn.net</link>
<description>Dedication to the preservaton of lewdtuber history</description>
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator> </generator>
<language>en</language>
<image>
<title>Futureporn.net</title>
<url>https://futureporn.net/images/futureporn-icon.png</url>
<link>https://futureporn.net</link>
</image>`;
for (const vod of data.vods) {
const url = `${env('ORIGIN')}/vods/${vod.id}`;
rss += `
<item>
<title><![CDATA[${
((vod?.get('expand')?.vtubers?.map(vt => vt.get('displayName')) || []).join(', ')
|| vod.get('streamDate'))
}]]></title>
<link>${url}</link>
<guid>${url}</guid>
<pubDate>${vod.get('streamDate')}</pubDate>`;
if (vod.notes) {
rss += `
<description><![CDATA[${vod.notes}]]></description>`;
}
if (vod.thumbnail) {
rss += `
<enclosure url="${vod.thumbnail}" length="0" type="image/png" />`;
}
rss += `
</item>`;
}
rss += `
</channel>
</rss>`;
// Send the RSS
response.html(200, rss);
%>