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=930&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 13226 results for "api"(1889ms)

evaltownWorkermain.tsx3 matches

@deepmojoUpdated 6 months ago
26 setError("");
27 try {
28 const res = await fetch(`${window.location.href}api?city=${encodeURIComponent(city)}`);
29 const data = await res.json();
30 if (data.error) {
159 const url = new URL(req.url);
160
161 if (req.method === "GET" && url.pathname === "/api") {
162 const city = url.searchParams.get("city");
163 if (!city) {
167 try {
168 const weatherUrl =
169 `https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41&current_weather=true&daily=temperature_2m_max,weathercode&timezone=auto&forecast_days=5`;
170 const weatherRes = await fetch(weatherUrl);
171 const weatherData = await weatherRes.json();

rabbitstreammain.tsx1 match

@temptempUpdated 6 months ago
16 const { provider, id } = c.req.param();
17 if (!["rabbit", "mega"].includes(provider)) {
18 return c.json({ error: "Invalid API request" }, 500);
19 }
20 // const cache = await blob.getJSON(id);

graphqlAPIEndpointREADME.md1 match

@fleschUpdated 6 months ago
1Migrated from folder: GraphQL/graphqlAPIEndpoint

falDemoAppmain.tsx2 matches

@gratitude5deeUpdated 6 months ago
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }

otherBrokenURLhandlermain.tsx2 matches

@willthereaderUpdated 6 months ago
71 `;
72
73 console.log(`Making LSD API request for ${pageUrl}...`);
74 const response = await fetch(
75 `https://lsd.so/api?query=${encodeURIComponent(query)}`
76 );
77

falDemoAppmain.tsx2 matches

@robertbrookUpdated 6 months ago
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }

curiousTurquoiseDormousemain.tsx11 matches

@CoachCompanionUpdated 6 months ago
332
333const css = `
334 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');
335
336 :root {
664async function server(request: Request): Promise<Response> {
665 if (request.method === "POST" && new URL(request.url).pathname === "/generate-training") {
666 const YOUTUBE_API_KEY = Deno.env.get("YOUTUBE_API_KEY2");
667 const useApiKey = YOUTUBE_API_KEY !== undefined && YOUTUBE_API_KEY !== "";
668 if (!YOUTUBE_API_KEY) {
669 console.warn("YouTube API key (YOUTUBE_API_KEY2) is not set. Falling back to search URL method.");
670 }
671
722 for (const placeholder of videoPlaceholders) {
723 const searchQuery = placeholder.replace('[VIDEO: ', '').replace(']', '');
724 const videoId = await getYouTubeVideoId(searchQuery, sport, YOUTUBE_API_KEY);
725 if (videoId) {
726 const embedHtml = `
805}
806
807async function getYouTubeVideoId(query, sport, apiKey, useApiKey = true) {
808 if (useApiKey) {
809 try {
810 const searchUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(sport + ' ' + query)}&key=${apiKey}&type=video&maxResults=1`;
811 const response = await fetch(searchUrl);
812 const data = await response.json();
813 if (data.error) {
814 console.warn("YouTube API error:", data.error.message);
815 return getFallbackYouTubeLink(query, sport);
816 }
819 }
820 } catch (error) {
821 console.error("Error fetching from YouTube API:", error);
822 }
823 }

efficientAmberUnicornmain.tsx11 matches

@CoachCompanionUpdated 6 months ago
8async function server(request: Request): Promise<Response> {
9 if (request.method === "POST" && new URL(request.url).pathname === "/generate-training") {
10 const YOUTUBE_API_KEY = Deno.env.get("YOUTUBE_API_KEY2");
11 const useApiKey = YOUTUBE_API_KEY !== undefined && YOUTUBE_API_KEY !== "";
12 if (!YOUTUBE_API_KEY) {
13 console.warn("YouTube API key (YOUTUBE_API_KEY2) is not set. Falling back to search URL method.");
14 }
15
29 for (const placeholder of videoPlaceholders) {
30 const searchQuery = placeholder.replace('[VIDEO: ', '').replace(']', '');
31 const videoData = await getYouTubeVideoData(searchQuery, sport, YOUTUBE_API_KEY);
32 if (videoData && isVideoRelevant(videoData, sport, searchQuery)) {
33 const embedHtml = `
49}
50
51async function getYouTubeVideoData(query, sport, apiKey, useApiKey = true) {
52 if (useApiKey) {
53 try {
54 const searchUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(sport + ' ' + query)}&key=${apiKey}&type=video&maxResults=5`;
55 const response = await fetch(searchUrl);
56 const data = await response.json();
57 if (data.error) {
58 console.warn("YouTube API error:", data.error.message);
59 return null;
60 }
61 if (data.items && data.items.length > 0) {
62 const videoId = data.items[0].id.videoId;
63 const videoUrl = `https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics&id=${videoId}&key=${apiKey}`;
64 const videoResponse = await fetch(videoUrl);
65 const videoData = await videoResponse.json();
78 }
79 } catch (error) {
80 console.error("Error fetching from YouTube API:", error);
81 }
82 }

falDemoAppmain.tsx2 matches

@daisukeUpdated 6 months ago
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }

geminiBboxmain.tsx15 matches

@yawnxyzUpdated 6 months ago
6 *
7 * Key features:
8 * - Integrates with Google's Generative AI API
9 * - Processes user-uploaded images for object detection
10 * - Visualizes detected objects with bounding boxes
11 * - Allows customization of detection parameters (grid, contrast)
12 * - Stores API key securely in browser's local storage
13 *
14 * The app is built using Hono.js and can be deployed on Val Town or run locally with Deno.
29<p>This application visualizes object detection results by drawing bounding boxes on images using the <a href="https://ai.google.dev/">Google's Gemini 1.5 Pro AI model</a>.</p>
30
31<p>API keys are only stored in your browser's local storage.</p>
32<p>Images are only sent to Google's Gemini API servers for processing.</p>
33
34<p>Try the following images (click the links to add them):</p>
174 window.handleImageUrlClick = handleImageUrlClick;
175
176 // Retrieves the API key from local storage or prompts the user to enter it
177 function getApiKey() {
178 let apiKey = localStorage.getItem("GEMINI_API_KEY");
179 if (!apiKey) {
180 apiKey = prompt("Please enter your Gemini API key:");
181 if (apiKey) {
182 localStorage.setItem("GEMINI_API_KEY", apiKey);
183 }
184 }
185 return apiKey;
186 }
187
188 // Initializes and returns a Google Generative AI model instance
189 async function getGenerativeModel(params) {
190 const API_KEY = getApiKey();
191 const genAI = new GoogleGenerativeAI(API_KEY);
192 return genAI.getGenerativeModel(params);
193 }
915 <div class="mt-2">
916 <p>Use this to detect bounding boxes of objects in an image. Use the image description to help with setting up the prompt. Rows and columns determine how many tiles the image will be divided into — for simple images, 1x1 is best.</p>
917 <p>For the free API you might get the "Resource has been exhausted" error if you make too many requests too quickly.</p>
918 <textarea id="promptInput" rows=6>Identify and return bounding boxes of the (MAIN SUBJECT) \n[ymin, xmin, ymax, xmax]</textarea>
919 <div class="checkbox-container my-2">

vapi-minutes-db1 file match

@henrywilliamsUpdated 2 days ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 3 days ago
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com