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=1&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 19647 results for "api"(1521ms)

group-mebasic.ts6 matches

@zalmentβ€’Updated 2 hours ago
3
4// Environment variables
5const GOOGLE_API_KEY = process.env.GOOGLE_API_KEY;
6const GROUPME_TOKEN = process.env.GROUPME_TOKEN;
7const GROUPME_GROUP_ID = process.env.GROUPME_GROUP_ID;
10// Initialize Google AI
11const ai = new GoogleGenAI({
12 apiKey: GOOGLE_API_KEY,
13});
14
15// GroupMe API configuration
16const baseUrl = "https://api.groupme.com/v3";
17
18// System prompt for Gimpel
90// Generate AI response using Gemini with chat-based conversation
91const generateResponse = async (messages) => {
92 if (!GOOGLE_API_KEY) {
93 throw new Error("Missing Google API key");
94 }
95

reactHonoStarterindex.ts2 matches

@anup_d911β€’Updated 2 hours ago
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
13
14// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
16
17// Unwrap and rethrow Hono errors as the original error

untitled-731main.tsx1 match

@choroukβ€’Updated 5 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 5 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 5 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 5 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 5 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 5 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 6 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 6 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 />

scrapeCraigslistAPI1 file match

@shapedlinesβ€’Updated 5 hours ago
Plantfo

Plantfo8 file matches

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