16 try {
17 if (resumeJsonUrl) {
18 const response = await fetch(resumeJsonUrl);
19 if (!response.ok) {
20 throw new Error(`Failed to fetch resume details from URL: ${response.statusText}`);
21 }
22 resumeDetails = await response.json();
23 }
24 } catch (error) {
25 console.error(`Error fetching resume data: ${error.message}`);
26 }
27
9export default async function main(req: Request) {
10 try {
11 const response = await fetch(fredApiUrl);
12 const data = await response.json();
13
37 }
38 } catch (error) {
39 await email({ subject: "Error fetching mortgage rates", text: error.message });
40 }
41}
71
72 const vttUrl = `https://stream.mux.com/${PLAYBACK_ID}/text/${TRACK_ID}.vtt`;
73 const vttResponse = await fetch(vttUrl);
74 const vttText = await vttResponse.text();
75
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));
226});
227
228export default app.fetch;
83 const form = event.target;
84 const formData = new FormData(form);
85 const response = await fetch('/api', {
86 method: 'POST',
87 headers: {
83 const form = event.target;
84 const formData = new FormData(form);
85 const response = await fetch('/api', {
86 method: 'POST',
87 headers: {
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
2import { load } from "npm:cheerio";
3import { format } from "npm:date-fns";
44};
45
46const fetchAndParsePage = async (url: string) => {
47 const html = await fetchText(url);
48 const $ = load(html);
49
51 if (url == onThisDayUrl) {
52 // pull all <ul>'s out and combine together
53 // this is fetching all 3 major sections (Events, Births, Deaths) but I really only care about Events
54 parsedBody = $(".mw-content-ltr > ul").text();
55 // FIXME this isn't quite working but is what I want...
83 }
84
85 const data = await fetchAndParsePage(url);
86 if (format == "json") {
87 return Response.json({ data: data.split("\n") });
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));
1// This val provides an HTML interface for uploading a CSV file of URLs, validates them,
2// and returns a downloadable CSV file with the results.
3// It uses the Fetch API to check each URL's status and generates a CSV report.
4// We'll use the built-in URL constructor for basic URL validation and the native fetch for HTTP requests.
5// The UI is now styled using Tailwind CSS and shadcn UI components for a more polished look.
6// Added functionality to show the selected filename in the UI.
70 try {
71 new URL(url); // Basic URL validation
72 const response = await fetch(url, { method: "HEAD" });
73 return { url, valid: response.ok, status: response.status };
74 } catch {