114 }
115
116 const html = await fetch(url.toString(), {
117 method: req.method,
118 headers: new Headers({
121 "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
122 "Accept-Language": "en-US,en;q=0.5",
123 "Sec-Fetch-Site": "cross-site",
124 "Sec-Fetch-Mode": "navigate",
125 "Sec-Fetch-User": "?1",
126 "Sec-Fetch-Dest": "document",
127 "Referer": "https://www.google.com/",
128 "sec-ch-ua": `"Not A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"`,
145 transcript += arr.map(({ text }) => text).join("\n\n");
146 } catch (e) {
147 transcript = `Failed to fetch transcript ${e}\n`;
148 }
149 let header = "";
153 + y.description + "\n</div>\n\n";
154 } catch (e) {
155 header = `Failed to fetch youtube metadata: ${e}\n`;
156 }
157 markdown = header + "\n" + transcript;
7async function markdown(url: string) {
8 const encoded = encodeURIComponent(url);
9 const response = await fetch(`https://markdown.download/?url=${encoded}`);
10 return await response.text();
11}
29 if (url.pathname == "/search") {
30 const query = url.searchParams.get("q");
31 const resp = await fetch(`https://api.github.com/search/code?q=${githubQuery(query)}`, {
32 headers: {
33 "Accept": "application/vnd.github.text-match+json",
4let location = "brooklyn ny";
5let lang = "en";
6const weather = await fetch(
7 `https://wttr.in/${location}?lang=${lang}&format=j1`,
8).then(r => r.json());
6
7function esmTown(url) {
8 return fetch(url, {
9 headers: {
10 "User-Agent":
15
16const app = new Hono();
17export default app.fetch;
18
19app.get("/", async (c) =>
34 };
35
36 const response = await fetch(`${url}?key=${apiKey}`, {
37 method: "POST",
38 headers,
1/** @jsxImportSource https://esm.sh/react */
2import { modifyFetchHandler as codeOnValTown } from "https://esm.town/v/andreterron/codeOnValTown?v=45";
3import { modifyResponse } from "https://esm.town/v/andreterron/codeOnVT_modifyResponse?v=9";
4
13
14 constructor() {}
15 async fetch(req: Request): Promise<Response> {
16 const gameInfo = parseURL(req.url);
17 if (gameInfo === undefined) {
232const sc = new StaticChess();
233
234export default sc.fetch.bind(sc);
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 }
10
11 constructor() {}
12 async fetch(req: Request): Promise<Response> {
13 const gameInfo = parseURL(req.url);
14 if (gameInfo === undefined) {
211
212const sc = new StaticChess();
213export default sc.fetch.bind(sc);
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
2import { html, load } from "npm:cheerio";
3
4const htmlStr = await fetchText(
5 "https://archive.is/pPFRB",
6);