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/image-url.jpg%20%22Image%20title%22?q=fetch&page=6&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 14436 results for "fetch"(1374ms)

TownieBranchSelect.tsx1 match

@ianmenethilUpdated 11 hours ago
32 return;
33 }
34 branches.refetch();
35 if (res?.branch?.id) {
36 navigate(`/chat/${projectId}/branch/${res.branch.id}`);

nightbot-master-commandnew-file-9775.tsx36 matches

@jaydenUpdated 11 hours ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { sqlite } from "https://esm.town/v/std/sqlite";
3// import randomPokemon from "jsr:random-pokemon";
22 console.log("handler.weather args=", args);
23 const location = encodeURIComponent(args.join(" "));
24 const res = await fetch(`https://wttr.in/${location}?format=%l:+%c+%t`);
25 if (!res.ok) {
26 console.error("weather fetch failed", res.status);
27 return `❌ Unable to fetch weather for "${args.join(" ")}"`;
28 }
29 return await res.text();
31 catfact: async () => {
32 console.log("handler.catfact");
33 const res = await fetch("https://catfact.ninja/fact");
34 if (!res.ok) {
35 console.error("catfact fetch failed", res.status);
36 return "❌ Couldn’t fetch a cat fact right now. Try again later!";
37 }
38 const { fact } = await res.json() as { fact: string };
41 advice: async () => {
42 console.log("handler.advice");
43 const res = await fetch("https://api.adviceslip.com/advice");
44 if (!res.ok) {
45 console.error("advice fetch failed", res.status);
46 return "❌ Couldn't fetch advice right now. Try again later!";
47 }
48 const { slip } = await res.json() as { slip: { advice: string } };
52 console.log("handler.dadjoke");
53 // icanhazdadjoke returns one random dad joke per request
54 const res = await fetch("https://icanhazdadjoke.com/", {
55 headers: { Accept: "application/json" },
56 });
57 if (!res.ok) {
58 console.error("dadjoke fetch failed", res.status);
59 return "❌ Couldn't fetch a joke right now. Try again later!";
60 }
61 const { joke } = await res.json() as { joke: string };
64 trivia: async () => {
65 console.log("handler.trivia");
66 const res = await fetch("http://numbersapi.com/random/trivia?json");
67 if (!res.ok) {
68 console.error("trivia fetch failed", res.status);
69 return "❌ Couldn't fetch trivia right now. Try again later!";
70 }
71 const { text, number } = await res.json() as { text: string; number: number };
74 compliment: async () => {
75 console.log("handler.compliment");
76 const res = await fetch("https://complimentr.com/api");
77 if (!res.ok) {
78 console.error("compliment fetch failed", res.status);
79 return "❌ Couldn't fetch a compliment right now. Try again later!";
80 }
81 const { compliment } = await res.json() as { compliment: string };
84 insult: async () => {
85 console.log("handler.insult");
86 const res = await fetch("https://evilinsult.com/generate_insult.php?lang=en&type=json");
87 if (!res.ok) {
88 console.error("insult fetch failed", res.status);
89 return "❌ Couldn't fetch an insult right now. Try again later!";
90 }
91 const { insult } = await res.json() as { insult: string };
215
216 // try {
217 // const res = await fetch(`https://ohmanda.com/api/horoscope/${sign}`);
218 // if (!res.ok) {
219 // console.error("horoscope fetch failed", res.status);
220 // return "❌ Couldn't fetch horoscope. Try again later!";
221 // }
222 // const { horoscope } = await res.json() as { horoscope: string };
223 // return `🔮 ${sign.charAt(0).toUpperCase() + sign.slice(1)}: ${horoscope}`;
224 // } catch {
225 // return "❌ Something went wrong fetching your stars!";
226 // }
227 // },
232 // return `🧬 Your Pokémon is: ${name.charAt(0).toUpperCase() + name.slice(1)}`;
233 // } catch {
234 // return "❌ Couldn't fetch a Pokémon!";
235 // }
236 // },
348 setTimeout(async () => {
349 try {
350 await fetch(responseUrl, {
351 method: "POST",
352 headers: { "Content-Type": "application/json" },
376 setTimeout(async () => {
377 try {
378 await fetch(responseUrl, {
379 method: "POST",
380 headers: { "Content-Type": "application/json" },
407 // }
408
409 // fetch one random chatter
410 let favorite: string;
411 try {
412 const res = await fetch(
413 `https://commands.garretcharp.com/twitch/chatter/vevisk?count=1&moderatorId=106247697`,
414 );
419 favorite = chatters[0]; // only one requested
420 } catch (err) {
421 console.error("favorite fetch failed", err);
422 return new Response("❌ Couldn't pick a favorite viewer right now.", {
423 headers: { "Content-Type": "text/plain" },
430 const drumroll = setTimeout(async () => {
431 try {
432 await fetch(responseUrl, {
433 method: "POST",
434 headers: { "Content-Type": "application/json" },
442 const reveal = setTimeout(async () => {
443 try {
444 await fetch(responseUrl, {
445 method: "POST",
446 headers: { "Content-Type": "application/json" },
473 // setTimeout(async () => {
474 // try {
475 // await fetch(responseUrl, {
476 // method: "POST",
477 // headers: { "Content-Type": "application/json" },
486 setTimeout(async () => {
487 try {
488 await fetch(responseUrl, {
489 method: "POST",
490 headers: { "Content-Type": "application/json" },

ChatREADME.md3 matches

@c15rUpdated 12 hours ago
40// Unified API across all components
41await clientPool.testServer(serverName);
42await clientPool.fetchTools();
43await clientPool.callTool(serverName, toolName, args);
44```
97│ ├── utils/
98│ │ ├── mcpTesting.ts # Frontend MCP server testing
99│ │ └── mcpPrompts.ts # Frontend MCP prompt fetching
100│ └── style.css # Custom styles with streaming animations
101├── shared/
150- `GET /shared/*` - Shared utility files
151
152**Note**: MCP server testing and prompt fetching are now handled directly on the frontend for improved performance and reduced server load.
153
154## Usage
Plantfo

Plantfoindex.ts5 matches

@LladUpdated 13 hours ago
177 }
178
179 console.log(`Fetching fresh data from OpenAI for: "${plantName}"`);
180 // If not cached, fetch from OpenAI
181 const prompt =
182 `Please provide detailed information about the plant "${plantName}" in the following JSON format. Be specific and accurate:
262 }
263 } catch (error) {
264 console.error("Error fetching plant information:", error);
265 return c.json({
266 error: "Failed to fetch plant information",
267 details: error instanceof Error ? error.message : "Unknown error",
268 }, 500);
385});
386
387export default app.fetch; // This is the entry point for HTTP vals

untitled-4336server.ts1 match

@takaUpdated 13 hours ago
11app.use(express.static("public")); // index.html を配置するディレクトリ
12
13app.post("/fetch", async (req, res) => {
14 const targetUrl = req.body.url;
15

untitled-4336index.html1 match

@takaUpdated 13 hours ago
26
27 try {
28 const res = await fetch('/fetch', {
29 method: 'POST',
30 headers: { 'Content-Type': 'application/json' },

betplaygroundmain.tsx1 match

@cyrilosUpdated 14 hours ago
308
309// Run the App
310export default app.fetch;

weatherStylist_Skienmain.tsx1 match

@sjaskeprutUpdated 14 hours ago
7
8 try {
9 const res = await fetch(url);
10 if (!res.ok) throw new Error(`API error: ${res.status} ${res.statusText}`);
11 const data = await res.json();

Skien_Stylist_UImain.tsx2 matches

@sjaskeprutUpdated 14 hours ago
4 const lon = 9.6090;
5
6 // Fetch current weather + hourly humidity & precipitation from Open-Meteo
7 const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}`
8 + `&current_weather=true&hourly=relativehumidity_2m,precipitation_probability&timezone=Europe%2FOslo`;
9
10 try {
11 const res = await fetch(url);
12 if (!res.ok) throw new Error(`API error: ${res.status} ${res.statusText}`);
13 const data = await res.json();

Skien_Stylistmain.tsx2 matches

@sjaskeprutUpdated 15 hours ago
3
4 try {
5 const res = await fetch(apiUrl);
6 if (!res.ok) throw new Error(`Failed to fetch: ${res.status} ${res.statusText}`);
7
8 const data = await res.json();

testWeatherFetcher1 file match

@sjaskeprutUpdated 15 hours ago

weatherFetcher1 file match

@sjaskeprutUpdated 15 hours ago