Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
import { parseFeed } from "https://deno.land/x/rss@1.0.0/mod.ts";
export async function getLastEpisode(xml: string) {
const { entries } = await parseFeed(xml);
return entries
.sort((entry1, entry2) => entry2.published.getTime() - entry1.published.getTime())
.at(0);
}
export async function getLastPubDate(xml: string) {
const lastEpisode = await getLastEpisode(xml);
return lastEpisode.published;
}
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!
December 6, 2023