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/$%7Bsuccess?q=fetch&page=651&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 9115 results for "fetch"(2288ms)

blob_adminmain.tsx2 matches

@nicopreme•Updated 8 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

scarletSolemain.tsx3 matches

@tempdev•Updated 8 months ago
32 url: "https://d000d.com/e/9x3w3pu0xemy",
33 };
34 const req = await fetch("http://turnsolver.pythonanywhere.com/solve", {
35 method: "POST",
36 headers: { "Content-Type": "application/json" },
39 const tokenReq = await req.json();
40 const token = tokenReq.token;
41 const ver = await fetch(
42 `https://cool-proxy.koyeb.app/hdiuhmalkmc9d0ck7UCFVGBJHN?destination=`
43 + encodeURIComponent(`https://d0000d.com/dood?op=validate&gc_response=${token}`),
66 return c.json({ worked: true });
67});
68export default app.fetch;

dailyDadJokemain.tsx2 matches

@cpdis•Updated 8 months ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

legitimateTanTigermain.tsx13 matches

@sharanbabu•Updated 8 months ago
4 * The suggestions are cached in the browser to reduce API calls.
5 * It implements a two-step LLM process: first to get initial suggestions, then to filter them for sensibility and ethics.
6 * If the second LLM call fails, it displays "Failed to fetch" instead of showing results.
7 */
8
19 const suggestionCache = useRef({});
20
21 const fetchSuggestions = async (input) => {
22 if (suggestionCache.current[input]) {
23 setSuggestions(suggestionCache.current[input]);
28 setError("");
29 try {
30 const response = await fetch("/suggestions", {
31 method: "POST",
32 headers: { "Content-Type": "application/json" },
33 body: JSON.stringify({ query: input }),
34 });
35 if (!response.ok) throw new Error("Failed to fetch suggestions");
36 const data = await response.json();
37 if (data.error) {
43 }
44 } catch (error) {
45 console.error("Error fetching suggestions:", error);
46 setError("Failed to fetch");
47 setSuggestions([]);
48 } finally {
51 };
52
53 const debouncedFetchSuggestions = useRef(
54 debounce(fetchSuggestions, 300),
55 ).current;
56
57 useEffect(() => {
58 if (query.length > 2) {
59 debouncedFetchSuggestions(query);
60 } else {
61 setSuggestions([]);
115
116 try {
117 const response = await fetch("https://api.cerebras.ai/v1/chat/completions", {
118 method: "POST",
119 headers: {
137
138 if (!response.ok) {
139 throw new Error("Failed to fetch from Cerebras API");
140 }
141
146
147 // Second LLM call to filter suggestions
148 const filterResponse = await fetch("https://api.cerebras.ai/v1/chat/completions", {
149 method: "POST",
150 headers: {
190 } catch (error) {
191 console.error("Error calling Cerebras API:", error);
192 return new Response(JSON.stringify({ error: "Failed to fetch" }), {
193 status: 500,
194 headers: { "Content-Type": "application/json" },

geocodemain.tsx10 matches

@stevekrouse•Updated 8 months ago
39 }, [selectedLocation]);
40
41 const fetchSuggestions = async (input) => {
42 if (suggestionCache.current[input]) {
43 setSuggestions(suggestionCache.current[input]);
47 setIsLoading(true);
48 try {
49 const response = await fetch("/geocode", {
50 method: "POST",
51 headers: { "Content-Type": "application/json" },
52 body: JSON.stringify({ query: input }),
53 });
54 if (!response.ok) throw new Error("Failed to fetch suggestions");
55 const data = await response.json();
56 setSuggestions(data);
57 suggestionCache.current[input] = data;
58 } catch (error) {
59 console.error("Error fetching suggestions:", error);
60 setSuggestions([]);
61 } finally {
64 };
65
66 const debouncedFetchSuggestions = useRef(
67 debounce(fetchSuggestions, 300)
68 ).current;
69
70 useEffect(() => {
71 if (query.length > 2) {
72 debouncedFetchSuggestions(query);
73 } else {
74 setSuggestions([]);
128
129 try {
130 const response = await fetch("https://api.cerebras.ai/v1/chat/completions", {
131 method: "POST",
132 headers: {
146
147 if (!response.ok) {
148 throw new Error("Failed to fetch from Cerebras API");
149 }
150
158 } catch (error) {
159 console.error("Error calling Cerebras API:", error);
160 return new Response(JSON.stringify({ error: "Failed to fetch suggestions" }), {
161 status: 500,
162 headers: { "Content-Type": "application/json" },

dataUriGenAppmain.tsx1 match

@g•Updated 8 months ago
200app.get('/main.js', serve(js, 'text/javascript'));
201
202export default app.fetch;

dailyDadJokemain.tsx2 matches

@hobbs•Updated 8 months ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

pushFrontendmain.tsx3 matches

@jrmann100•Updated 8 months ago
13 }
14 let clientSubscription = await registration.pushManager.getSubscription();
15 let serverSubscription = await (await fetch("/subscription")).json();
16
17 if (clientSubscription === null) {
45 button.disabled = true;
46 button.textContent = await (
47 await fetch("/subscription", {
48 method: "PUT",
49 body: JSON.stringify(
53 userVisibleOnly: true,
54 applicationServerKey: await (
55 await fetch("/vapidPublicKey")
56 ).text(),
57 }),

placeholderKittenImagesmain.tsx1 match

@shawnbasquiat•Updated 8 months ago
136 try {
137 console.log(`Generating image with dimensions: ${width}x${height}`);
138 const imageResponse = await fetch(imageGenerationUrl);
139 console.log(`Response status: ${imageResponse.status}`);
140

resizeImageErrormain.tsx8 matches

@shawnbasquiat•Updated 8 months ago
13 const handleSubmit = async (e: React.FormEvent) => {
14 e.preventDefault();
15 const response = await fetch(`?link=${encodeURIComponent(imageUrl)}&size=${size}`);
16 try {
17 if (response.ok) {
75 const testImageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png";
76 const testSize = "100x100";
77 const cloudinaryUrl = `https://res.cloudinary.com/demo/image/fetch/c_fill,w_100,h_100/${encodeURIComponent(testImageUrl)}`;
78
79 try {
80 const response = await fetch(cloudinaryUrl);
81 if (response.ok) {
82 console.log("Test endpoint successful");
83 return "Test successful";
84 } else {
85 throw new Error(`Failed to fetch image: ${response.status} ${response.statusText}`);
86 }
87 } catch (error) {
123 }
124
125 const cloudinaryUrl = `https://res.cloudinary.com/demo/image/fetch/c_fill,w_${width},h_${height}/${encodeURIComponent(link)}`;
126
127 try {
128 const imageResponse = await fetch(cloudinaryUrl);
129
130 if (!imageResponse.ok) {
131 throw new Error(`Failed to fetch image: ${imageResponse.status} ${imageResponse.statusText}`);
132 }
133
140 });
141 } catch (error) {
142 console.error("Error fetching or processing image:", error.message, error.stack);
143 return new Response(`Error processing image: ${error.message}. Please ensure the image URL is correct and publicly accessible.`, { status: 500 });
144 }

proxyFetch2 file matches

@vidar•Updated 10 hours ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 1 day ago