2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
26});
27
28export async function getCrateInfo(crateName: string, version?: string) {
29 const createURL = joinURL(API_URL, `/crates/${crateName}`);
30 const crateInfo = parse(CrateInfoSchema, await ky.get(createURL).json());
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
17});
18
19export async function getPkgInfo(pkgName: string, version = "latest") {
20 const pkgURL = new URL(encodeURIComponent(pkgName).replace(/^%40/, "@"), REGISTRY_URL);
21 const headers = {
58export default app.fetch;
59
60async function getBadgeOptions(rssUrl: string | URL): Promise<BadgenOptions> {
61 const label = BADGE_LABEL;
62 try {
1export function isSpotifyPodcast(podcastURL: URL | string) {
2 try {
3 podcastURL = new URL(podcastURL);
9}
10
11export function getSpotifyId(podcastURL: URL | string) {
12 try {
13 podcastURL = new URL(podcastURL);
1export function isApplePodcast(podcastURL: URL | string) {
2 try {
3 podcastURL = new URL(podcastURL);
9}
10
11export function getItunesId(podcastURL: URL | string) {
12 try {
13 podcastURL = new URL(podcastURL);
6const isString = (arg): arg is string => typeof arg === "string";
7
8export async function getPodnewsId(podcastId: string) {
9 // https://podnews.net/podcast/subscribe-pages
10 const redirectURL = new URL(`/podcast/${podcastId}`, BASE_URL);
24type PodcastInfo = { podcastId: string } | { podnewsId: string };
25
26export async function getFeedUrl(podcastInfo: PodcastInfo) {
27 let podnewsId;
28 if ("podnewsId" in podcastInfo) {
1import { parseFeed } from "https://deno.land/x/rss@1.0.0/mod.ts";
2
3export async function getLastEpisode(xml: string) {
4 const { entries } = await parseFeed(xml);
5 return entries
8}
9
10export async function getLastPubDate(xml: string) {
11 const lastEpisode = await getLastEpisode(xml);
12 return lastEpisode.published;
2import process from "node:process";
3
4export async function handleGroupmeMessage(
5 req: express.Request,
6 res: express.Response,
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",