Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bart_info.art.src%7D?q=fetch&page=85&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 8581 results for "fetch"(829ms)

OpenTownieBranchSelect.tsx1 match

@jxnblk•Updated 1 week ago
33 return;
34 }
35 branches.refetch();
36 if (res?.branch?.id) {
37 navigate(`/chat/${projectId}/branch/${res.branch.id}`);

celestialBlushDuckmain.tsx2 matches

@tyler71•Updated 1 week ago
11 Authorization: `Bearer ${authorization}`,
12 };
13 const res = await fetch(`${apiUrl}/linode/instances/${serverId}/reboot`);
14 return res.ok;
15}
54});
55
56export default app.fetch;

googleCalendarDayEndpointmain.tsx4 matches

@britt•Updated 1 week ago
1// This approach uses Google OAuth to authenticate the user and fetch their actual calendar events for the week.
2// It requires setting up OAuth credentials in the Google Cloud Console and configuring environment variables in Val Town.
3
49
50 // Exchange code for tokens
51 const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
52 method: "POST",
53 headers: {
66 const tokens = await tokenResponse.json();
67
68 // Fetch calendar events for this week
69 const now = new Date();
70 const oneWeekLater = new Date(now.getTime() + 24 * 60 * 60 * 1000);
71
72 const calendarResponse = await fetch(
73 `https://www.googleapis.com/calendar/v3/calendars/primary/events?`
74 + `timeMin=${now.toISOString()}`

whgovwiremain.tsx1 match

@jimniels•Updated 1 week ago
4export default async function(interval: Interval) {
5 const key = "whgovwire_" + (new Date()).toISOString();
6 const html = await fetch("https://www.whitehouse.gov/wire/").then(res => res.text());
7 const $ = cheerio.load(html);
8

WebsiteFrontPageAlbummain.tsx2 matches

@edgeeffect•Updated 1 week ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
2import { DOMParser, type Element } from "jsr:@b-fuze/deno-dom";
3
53 return;
54 }
55 fetchText(`https://ibb.co/album/${album}`).then(html =>
56 resolve(Response.json(albumItems(html), cacheControl()))
57 );

HTTP101basePage1 match

@willthereader•Updated 1 week ago
31app.get("/guides/HTTP101", HTTP101);
32
33export default app.fetch;

HTTP101guides1 match

@willthereader•Updated 1 week ago
40app.get("/guides/HTTP101", HTTP101);
41
42export default app.fetch;

guidemain.tsx1 match

@salon•Updated 1 week ago
122 return generatedData;
123 } catch (error) {
124 console.error("Error fetching or processing data from OpenAI:", error);
125 console.warn("Using fallback race data due to the error.");
126 // Ensure fallback data also has the hint, slice correctly

policy2main.tsx9 matches

@salon•Updated 1 week ago
592 errorInvalidFile: "Invalid file type. Please upload a PDF.",
593 errorFileSize: "File is too large (Max {maxSize}).",
594 errorFetchFailed: "Failed to perform analysis: {errorMessage}",
595 // Contact Placeholders
596 contactNamePlaceholder: "Your Name",
651 errorInvalidFile: "Tipo de archivo inválido. Por favor, suba un PDF.",
652 errorFileSize: "El archivo es demasiado grande (Máx {maxSize}).",
653 errorFetchFailed: "Falló la realización del análisis: {errorMessage}",
654 // Contact Placeholders
655 contactNamePlaceholder: "Tu Nombre",
851
852 try {
853 const response = await fetch(window.location.pathname + '?format=json', { method: 'POST', headers: { 'Accept': 'application/json'}, body: formData });
854 updateLoadingProgress(25, 'loadingStatusAnalysis'); // Adjusted percentage
855 const data = await response.json();
884 } catch (error) {
885 console.error('Analysis Request Error:', error);
886 displayError('errorFetchFailed', { errorMessage: error.message });
887 resultsContent.style.display = 'none'; // Ensure results area hidden on error
888 noResultsMessage.style.display = 'block';
918 const { OpenAI } = await import("https://esm.town/v/std/openai");
919 const { z } = await import("npm:zod");
920 const { fetch } = await import("https://esm.town/v/std/fetch");
921 const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");
922
1001 try {
1002 log.push({ agent, type: "step", message: `Workspaceing: ${url}` });
1003 const res = await fetch(url, {
1004 headers: { "User-Agent": "ValTownPolicyAnalysisBot/1.0" },
1005 redirect: "follow",
1074 try {
1075 if (!input.documentUrl.match(/^https?:\/\//i)) throw new Error("Invalid URL scheme.");
1076 const res = await fetch(input.documentUrl, {
1077 headers: { "Accept": "text/plain, text/html, application/pdf", "User-Agent": "ValTownPolicyAnalysisBot/1.0" },
1078 redirect: "follow",
1091 } else if (ct.includes("text/") || ct === "") {
1092 const text = await res.text();
1093 if (!text?.trim()) throw new Error("Fetched empty text.");
1094 log.push({ agent: ingestAgent, type: "result", message: `Workspaceed ~${text.length} chars.` });
1095 docText = text;
1096 } else { throw new Error(`Unsupported content type: ${ct}`); }
1097 } catch (e) {
1098 log.push({ agent: ingestAgent, type: "error", message: `URL fetch/process failed: ${e.message}` });
1099 docText = null;
1100 }

whatDoYouThinkOfItSoFarmain.tsx2 matches

@edgeeffect•Updated 1 week ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
3import { type Document, DOMParser, type Node } from "jsr:@b-fuze/deno-dom";
4
42
43export default (interval: Interval) => {
44 fetchText(
45 Deno.env.get("rubbish_url")
46 ).then(html => {

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago