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/$%7Burl%7D?q=api&page=3&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 19661 results for "api"(3328ms)

untitled-731main.tsx1 match

@choroukβ€’Updated 9 hours ago
1// @title SportifyMA Core API – Multilingual Event Info
2// @desc Returns event details, transport info, ticket mock, and alerts in user-selected language
3

houseSearchSFscrapedHouses.tsx7 matches

@shapedlinesβ€’Updated 9 hours 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 */
88 if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {
89 const { link } = await request.json();
90 let scrapingEndpoint;
91
92 if (link.includes("zillow.com")) {
93 scrapingEndpoint = "https://shapedlines-scrapezillowapi.web.val.run?url=";
94 } else if (link.includes("craigslist.org")) {
95 scrapingEndpoint = "https://shapedlines-scrapecraigslistapi.web.val.run?url=";
96 } else {
97 return new Response(JSON.stringify({ error: "Invalid link. Please provide a Zillow or Craigslist link." }), {
102
103 try {
104 const scrapeResponse = await fetch(`${scrapingEndpoint}${encodeURIComponent(link)}`);
105 if (!scrapeResponse.ok) {
106 throw new Error("Failed to scrape data");
110 // Calculate transit time
111 const transitResponse = await fetch(
112 `https://shapedlines-calculatetransitapi.web.val.run?address=${encodeURIComponent(scrapeResult.address)}`,
113 );
114 if (!transitResponse.ok) {

untitled-3501main.tsx1 match

@choroukβ€’Updated 9 hours ago
1// @title SportifyMA Core API – Multilingual Event Info
2// @desc Returns event details, transport info, ticket mock, and alerts in user-selected language
3

houseSearchSFscrapeCraigslistAPI.tsx0 matches

@shapedlinesβ€’Updated 9 hours ago
1import * as cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
2
3export default async function server(request: Request): Promise<Response> {
4 const url = new URL(request.url).searchParams.get("url");
5

houseSearchSFcalculateTransitAPI.tsx22 matches

@shapedlinesβ€’Updated 9 hours ago
21 }
22
23 const apiKey = Deno.env.get("GOOGLE_MAPS_API_KEY");
24 if (!apiKey) {
25 return new Response(JSON.stringify({ error: "API key is not configured" }), {
26 status: 500,
27 headers: { "Content-Type": "application/json" },
35 const gyms = await blob.getJSON("SF_Gyms");
36
37 const nearestGrocery = await findNearest(origin, groceries, apiKey);
38 const nearestGym = await findNearest(origin, gyms, apiKey);
39
40 const fidiDestination = "548 Market St, San Francisco, CA 94104";
41 const fidiDrivingTime = await getDrivingTime(origin, fidiDestination, apiKey);
42
43 const robloxDestination = "910 Park Pl Ste 300, San Mateo, CA 94403";
44 const robloxDrivingTime = await getDrivingTime(origin, robloxDestination, apiKey, "09:00:00", "Tuesday");
45
46 const samsaraDestination = "1 De Haro St, San Francisco, CA 94103";
47 const samsaraTransitTime = await getTransitTime(origin, samsaraDestination, apiKey);
48
49 const zipCode = await getZipCode(origin, apiKey);
50 const neighborhoodZipMap = await blob.getJSON("SF_Neighborhood_ZIP");
51 const neighborhood = neighborhoodZipMap[zipCode] || "Unknown";
75}
76
77async function findNearest(origin: string, locations: any[], apiKey: string): Promise<any> {
78 const batchSize = 25;
79 let nearestLocation = null;
83 const batch = locations.slice(i, i + batchSize);
84 const destinations = batch.map(location => `${location.gps.lat},${location.gps.lng}`).join("|");
85 const distanceMatrixUrl = `https://maps.googleapis.com/maps/api/distancematrix/json?origins=${
86 encodeURIComponent(origin)
87 }&destinations=${encodeURIComponent(destinations)}&mode=driving&key=${apiKey}`;
88
89 const response = await fetch(distanceMatrixUrl);
91
92 if (data.status !== "OK") {
93 throw new Error(`Distance Matrix API failed. Status: ${data.status}`);
94 }
95
116 origin: string,
117 destination: string,
118 apiKey: string,
119 arrivalTime?: string,
120 arrivalDay?: string,
121): Promise<string> {
122 let directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${
123 encodeURIComponent(origin)
124 }&destination=${encodeURIComponent(destination)}&mode=driving&key=${apiKey}`;
125
126 if (arrivalTime && arrivalDay) {
142}
143
144async function getTransitTime(origin: string, destination: string, apiKey: string): Promise<string> {
145 const directionsUrl = `https://maps.googleapis.com/maps/api/directions/json?origin=${
146 encodeURIComponent(origin)
147 }&destination=${encodeURIComponent(destination)}&mode=transit&key=${apiKey}`;
148
149 const directionsResponse = await fetch(directionsUrl);
159}
160
161async function getZipCode(address: string, apiKey: string): Promise<string> {
162 const geocodeUrl = `https://maps.googleapis.com/maps/api/geocode/json?address=${
163 encodeURIComponent(address)
164 }&key=${apiKey}`;
165 const response = await fetch(geocodeUrl);
166 const data = await response.json();

houseSearchSFscrapeZillowAPI.tsx2 matches

@shapedlinesβ€’Updated 9 hours ago
64 });
65 } catch (error) {
66 console.error("Error scraping Zillow:", error);
67 return new Response(JSON.stringify({ error: "Error scraping Zillow listing" }), {
68 status: 500,
69 headers: { "Content-Type": "application/json" },

finalScrapermain.tsx7 matches

@shapedlinesβ€’Updated 10 hours 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 */
88 if (request.method === "POST" && new URL(request.url).pathname === "/scrape") {
89 const { link } = await request.json();
90 let scrapingEndpoint;
91
92 if (link.includes("zillow.com")) {
93 scrapingEndpoint = "https://shapedlines-scrapezillowapi.web.val.run?url=";
94 } else if (link.includes("craigslist.org")) {
95 scrapingEndpoint = "https://shapedlines-scrapecraigslistapi.web.val.run?url=";
96 } else {
97 return new Response(JSON.stringify({ error: "Invalid link. Please provide a Zillow or Craigslist link." }), {
102
103 try {
104 const scrapeResponse = await fetch(`${scrapingEndpoint}${encodeURIComponent(link)}`);
105 if (!scrapeResponse.ok) {
106 throw new Error("Failed to scrape data");
110 // Calculate transit time
111 const transitResponse = await fetch(
112 `https://shapedlines-calculatetransitapi.web.val.run?address=${encodeURIComponent(scrapeResult.address)}`,
113 );
114 if (!transitResponse.ok) {

ChatStreamingChat.tsx8 matches

@c15rβ€’Updated 11 hours ago
174 /** Retry a user message */
175 const retryMessage = async (messageId: string) => {
176 if (status !== "idle" || !config.anthropicApiKey) return;
177
178 const userText = onRetryFromMessage(messageId);
200 console.log("[Chat] fire send", { userText, input });
201 const messageText = userText || input.trim();
202 if (!messageText || status !== "idle" || !config.anthropicApiKey) return;
203
204 // Only clear input if we're using the current input (not NextSteps execution)
268 };
269
270 const canSend = input?.trim() && status === "idle" && config.anthropicApiKey;
271
272 /* ── UI ─────────────────────────────────────────────────────── */
274 <>
275 <div className="chat-messages">
276 {!config.anthropicApiKey && (
277 <div className="message system">
278 Please configure your Anthropic API key in settings to start chatting
279 </div>
280 )}
384 }}
385 onKeyDown={handleKeyDown}
386 placeholder={config.anthropicApiKey
387 ? streaming
388 ? "Press Enter to stop streaming…"
390 ? "Waiting for your input above…"
391 : "Type your message or / for commands…"
392 : "Configure API key in settings first"}
393 className="chat-input"
394 disabled={!config.anthropicApiKey || thinking || waitingForUser}
395 rows={1}
396 />

ChatuseAnthropicStream.tsx7 matches

@c15rβ€’Updated 11 hours ago
200 /* Anthropic SDK instance – memoised so we don't recreate each render */
201 const anthropic = React.useMemo(() => {
202 if (!config.anthropicApiKey) return null;
203 return new Anthropic({
204 dangerouslyAllowBrowser: true,
205 apiKey: config.anthropicApiKey,
206 baseURL: "https://api.anthropic.com",
207 defaultHeaders: {
208 "anthropic-version": "2023-06-01",
210 },
211 });
212 }, [config.anthropicApiKey]);
213
214 /* Abort helper */
244 const streamMessage = React.useCallback(
245 async (messages: any[]): Promise<{ message: AssistantMsg; stopReason: string }> => {
246 if (!anthropic) throw new Error("API key missing");
247
248 // Use the existing buildBody helper but override messages
268 })) as AsyncIterable<MessageStreamEvent>;
269 } catch (err: any) {
270 console.error("Failed to call Anthropic API", err);
271 throw err;
272 }
338 const send = React.useCallback(
339 async (history: Message[], userText: string): Promise<Message[]> => {
340 if (!anthropic) throw new Error("API key missing");
341 if (status !== "idle") throw new Error("Stream already in progress");
342

SocialArchetypeQuizindex.ts3 matches

@mccailsβ€’Updated 11 hours ago
954 const url = new URL(req.url);
955
956 // API endpoints
957 if (url.pathname === '/api/results') {
958 try {
959 const limit = parseInt(url.searchParams.get('limit') || '50');
986 }
987
988 if (url.pathname === '/api/stats') {
989 try {
990 const stats = await getQuizStats();

scrapeCraigslistAPI1 file match

@shapedlinesβ€’Updated 9 hours ago
Plantfo

Plantfo8 file matches

@Lladβ€’Updated 20 hours ago
API for AI plant info
apiry
snartapi