9 let reason: string;
10 try {
11 const res = await fetch(URL, { redirect: "follow" });
12 if (res.status !== 200) {
13 reason = `(status code: ${res.status})`;
15 }
16 } catch (e) {
17 reason = `couldn't fetch: ${e}`;
18 ok = false;
19 }
61
62 async transaction(stmts: InStatement[]): Promise<DatabaseResultSet[]> {
63 const r = await fetch(`/api/batch`, {
64 method: "POST",
65 headers: {
81
82 async query(stmt: InStatement): Promise<DatabaseResultSet> {
83 const r = await fetch(`/api/execute`, {
84 method: "POST",
85 headers: {
4
5export let isBoeing = async (airline, number) => {
6 const response = await fetch("https://www.flightstats.com/v2/flight-tracker/" + airline + "/" + number);
7 const body = await response.text();
8 const $ = cheerio.load(body);
4
5export let isBoeing = async (airline, number) => {
6 const response = await fetch("https://www.flightstats.com/v2/flight-tracker/" + airline + "/" + number);
7 const body = await response.text();
8 const $ = cheerio.load(body);
1// import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// export let comments = ["hello world!"];
4
5// export let twitterJSON = ({ url, bearerToken }) =>
6// fetchJSON(
7// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
8// { headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` } },
10
11// export function handler(request: Request) {
12// let elements = fetchJSON(
13// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
14// { headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` } },
19
20export default async function(req: Request): Promise<Response> {
21 return fetch(
22 "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
23 // headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` }
2import { blob } from "https://esm.town/v/std/blob?v=11";
3import { email } from "https://esm.town/v/std/email?v=9";
4import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
5
6let currency = async (desired, base = "usd", amount = 1) => {
7 // let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`);
8 // if (rates && rates[desired.toUpperCase()]) return amount * (rates[desired.toUpperCase()]);
9 // else {
10 let { rates } = await fetchJSON("https://api.coingecko.com/api/v3/exchange_rates");
11 return amount * rates[desired.toLowerCase()]?.value / rates[base.toLowerCase()]?.value;
12};
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 );
2
3export default async function(interval: Interval) {
4 const resp = await fetch("https://www.nintendo.com/au/nintendo-live-2024-sydney");
5 const html = await resp.text();
6 if (resp.ok) {
35
36async function postJson(url, body?) {
37 return await fetch(url, {
38 method: "POST",
39 headers: { "Content-Type": "application/json" },
298 return c.json("success");
299});
300export default app.fetch;