1Migrated from folder: Archive/auth/signedFetch
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );
1import { latLngOfCity } from "https://esm.town/v/jdan/latLngOfCity";
2import { fetchWebpage } from "https://esm.town/v/jdan/fetchWebpage";
3import { weatherOfLatLon } from "https://esm.town/v/jdan/weatherOfLatLon";
4import { OpenAI } from "https://esm.town/v/std/openai?v=4";
59 call: weatherOfLatLon
60 },
61 "fetchWebpage": {
62 openAiTool: {
63 type: "function",
64 function: {
65 name: "fetchWebpage",
66 description: "Fetch the weather forecast from the contents of a forecast URL",
67 parameters: {
68 type: "object",
78 }
79 },
80 call: fetchWebpage
81 }
82};
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
2
3export async function fetchWebpage(args: { url: string }) {
4 const { url } = args;
5 const html = await fetchText(args.url);
6 return html;
7}
1Migrated from folder: openai_function_calling/fetchWebpage
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
2import { load } from "npm:cheerio";
3
4export async function latLngOfCity(args: { cityName: string }) {
5 const { cityName } = args;
6 const html = await fetchText(
7 `https://en.wikipedia.org/wiki/${cityName}`,
8 );
1import { email } from "https://esm.town/v/std/email?v=11";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export default async () => {
8 let reason: string;
9 try {
10 const res = await fetch(URL);
11 if (res.status !== 200) {
12 reason = `(status code: ${res.status})`;
14 }
15 } catch (e) {
16 reason = `couldn't fetch: ${e}`;
17 ok = false;
18 }
7
8export default async function(interval: Interval) {
9 const page = await fetch(site).then(res => res.text());
10 const date = page.match(/Last updated: <time datetime="([^"]+)">/)?.[1].toString();
11 const lastChange = await blob.get(dateChangedKey).then(res => res?.text()).catch(() => "");
22});
23
24export default app.fetch;
1import { email } from "https://esm.town/v/std/email?v=11";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export default async (URL) => {
7 let reason: string;
8 try {
9 const res = await fetch(URL);
10 if (res.status !== 200) {
11 reason = `(status code: ${res.status})`;
13 }
14 } catch (e) {
15 reason = `couldn't fetch: ${e}`;
16 ok = false;
17 }