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=9&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 14438 results for "fetch"(2183ms)

houseSearchSFcalculateTransitAPI.tsx4 matches

@shapedlines•Updated 1 day ago
87 }&destinations=${encodeURIComponent(destinations)}&mode=driving&key=${apiKey}`;
88
89 const response = await fetch(distanceMatrixUrl);
90 const data = await response.json();
91
130 }
131
132 const directionsResponse = await fetch(directionsUrl);
133 const directionsData = await directionsResponse.json();
134
147 }&destination=${encodeURIComponent(destination)}&mode=transit&key=${apiKey}`;
148
149 const directionsResponse = await fetch(directionsUrl);
150 const directionsData = await directionsResponse.json();
151
163 encodeURIComponent(address)
164 }&key=${apiKey}`;
165 const response = await fetch(geocodeUrl);
166 const data = await response.json();
167

umbrellaRemindermain.tsx2 matches

@code_whisperer•Updated 1 day ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );

scrapeCraigslistAPImain.tsx1 match

@shapedlines•Updated 1 day ago
9
10 try {
11 const response = await fetch(url);
12 const html = await response.text();
13

houseSearchSFscrapeZillowAPI.tsx1 match

@shapedlines•Updated 1 day ago
16
17 try {
18 const response = await fetch(zillowUrl);
19 const html = await response.text();
20 const $ = cheerio.load(html);

finalScrapermain.tsx6 matches

@shapedlines•Updated 1 day ago
1// This val creates a form to input a Zillow or Craigslist link, determines the link type,
2// calls the appropriate scraping API, and renders the results in a table.
3// It uses React for the UI, fetch for API calls, and basic string manipulation for link validation.
4
5/** @jsxImportSource https://esm.sh/react */
20
21 try {
22 const response = await fetch("/scrape", {
23 method: "POST",
24 headers: { "Content-Type": "application/json" },
27
28 if (!response.ok) {
29 throw new Error("Failed to fetch data");
30 }
31
33 setResults(data);
34 } catch (err) {
35 setError("An error occurred while fetching the data.");
36 } finally {
37 setIsLoading(false);
102
103 try {
104 const scrapeResponse = await fetch(`${scrapingEndpoint}${encodeURIComponent(link)}`);
105 if (!scrapeResponse.ok) {
106 throw new Error("Failed to scrape data");
109
110 // Calculate transit time
111 const transitResponse = await fetch(
112 `https://shapedlines-calculatetransitapi.web.val.run?address=${encodeURIComponent(scrapeResult.address)}`,
113 );

SocialArchetypeQuizindex.ts5 matches

@mccails•Updated 1 day ago
843 }));
844 } catch (error) {
845 console.error('Error fetching results:', error);
846 return [];
847 }
886 };
887 } catch (error) {
888 console.error('Error fetching stats:', error);
889 return {
890 total: 0,
978 return new Response(JSON.stringify({
979 success: false,
980 error: 'Failed to fetch results'
981 }), {
982 status: 500,
1002 return new Response(JSON.stringify({
1003 success: false,
1004 error: 'Failed to fetch stats'
1005 }), {
1006 status: 500,
1231 const handleConfirm = async () => {
1232 try {
1233 await fetch(window.location.href, {
1234 method: 'POST',
1235 headers: { 'Content-Type': 'application/json' },

Det_Skide_Vaermain.tsx1 match

@sjaskeprut•Updated 1 day ago
3 const lon = 9.6;
4
5 const response = await fetch(
6 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current_weather=true`,
7 );

ssscQuizadmin.http.ts3 matches

@all•Updated 1 day ago
128 });
129 } catch (error) {
130 return c.json({ error: "Failed to fetch data" }, 500);
131 }
132});
629
630 try {
631 const response = await fetch(\`/api/submissions/\${id}\`, {
632 method: 'DELETE',
633 headers: {
736}
737
738export default app.fetch;

ssscQuizindex.http.ts3 matches

@all•Updated 1 day ago
318 });
319 } catch (error) {
320 console.error("Error fetching analytics:", error);
321 return c.json({ error: "Failed to fetch analytics" }, 500);
322 }
323});
539
540// Export the Hono app as the default export for HTTP val
541export default app.fetch;

townie-testingexample-apis.ts2 matches

@chadparker•Updated 1 day ago
26 }
27
28 const response = await fetch(apiUrl);
29
30 if (!response.ok) {
38
39 } catch (error) {
40 return new Response(`Fetch Error: ${error.message}`, { status: 500 });
41 }
42}

testWeatherFetcher1 file match

@sjaskeprut•Updated 19 hours ago

weatherFetcher1 file match

@sjaskeprut•Updated 19 hours ago