Public
Script
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
import { fetchHtmlDom } from "https://esm.town/v/aeaton/fetchHtmlDom";
export async function kpunkShows() {
const url = "https://kpunk.libsyn.com/";
const dom = await fetchHtmlDom(url);
const items = dom.querySelectorAll(".leftnav a[href^='/webpage']");
const regex = /^\/webpage\/\d{4}\/\d{2}$/;
return [...items].map((link) => link.getAttribute("href")).filter((link) =>
regex.test(link)
).map((link) => new URL(link, url).toString());
}
October 23, 2023