9}
10
11async function fetchText(url: string, options?: any) {
12 const response = await fetch(normalizeURL(url), {
13 redirect: "follow",
14 ...(options || {}),
19
20export const webScrapeBytesNewsletter = async () => {
21 const html = await fetchText(NEWSLETTER_URL);
22 const $ = cheerio.load(html);
23 const latestIssueSection = $("main > :nth-child(2)");
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;
24 let example;
25 try {
26 example = await fetchValtownExample(scope, name, version);
27 } catch {}
28 if (example) {
39}
40
41async function fetchValtownExample(scope: string, name: string, version: string) {
42 const pkgConfig = await getConfig(scope, name, version);
43 version = pkgConfig.version;
3import { gfm } from "https://esm.town/v/pomdtr/gfm?v=24";
4import { appendFragment } from "https://esm.town/v/vladimyr/appendFragment";
5import { fetchVal } from "https://esm.town/v/vladimyr/fetchVal";
6import { linkifyReadme } from "https://esm.town/v/vladimyr/linkifyReadme";
7
14 return async (): Promise<Response> => {
15 const { author, name } = extractValInfo(valUrl);
16 const { readme } = await fetchVal(author, name);
17 if (!readme) {
18 return new Response(null, { status: 404 });
66 "embed",
67 "document",
68 ].includes(req.headers.get("sec-fetch-dest"))
69 )
70 return new Response(
2 const before = Date.now();
3 const serverTs = new Date(
4 (await fetch(
5 "https://www.dumbingofage.com/wp-content/uploads/css/custom_style.css?v=" +
6 Date.now()
1Migrated from folder: a2_shared/fetch_example2
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;
2import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
3import { createInstanceActor } from "https://esm.town/v/vladimyr/activityPubInstanceActor";
4import { createSignedFetch } from "https://esm.town/v/vladimyr/signedFetch";
5import { privateKeyPem, publicKeyPem } from "https://esm.town/v/vladimyr/signRequest_testdata";
6
12export { id, publicKeyId };
13
14const signedFetch = createSignedFetch({
15 pkcs8: privateKeyPem,
16 publicKeyId,
21 const query = Object.fromEntries(searchParams.entries());
22 if (pathname === "/" && query.url) {
23 const resp = await signedFetch(query.url, {
24 headers: { accept: "application/activity+json" },
25 });
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const gsheet_call = async (service_account, sheet_id, method, action, data) => {
9 };
10 const token = await getToken(service_account, googleAuthOptions);
11 const result = fetchJSON(
12 `https://sheets.googleapis.com/v4/spreadsheets/${sheet_id}/${action}`,
13 {