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/$2?q=api&page=1391&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 17851 results for "api"(2541ms)

browserbasePuppeteerExamplemain.tsx1 match

@moe•Updated 7 months ago
2
3const browser = await puppeteer.connect({
4 browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
5})
6

efficientWhiteBobolinkmain.tsx3 matches

@deepmojo•Updated 7 months ago
13 setError("");
14 try {
15 const res = await fetch(`${window.location.origin}/api`, {
16 method: 'POST',
17 headers: {
123 const url = new URL(req.url);
124
125 if (req.method === "POST" && url.pathname === "/api") {
126 try {
127 const { domain } = await req.json();
130 }
131
132 const firecrawlResponse = await fetch("https://api.firecrawl.dev/v1/map", {
133 method: "POST",
134 headers: {

evaltownWorkermain.tsx3 matches

@deepmojo•Updated 7 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

@temptemp•Updated 7 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

@flesch•Updated 7 months ago
1Migrated from folder: GraphQL/graphqlAPIEndpoint

falDemoAppmain.tsx2 matches

@gratitude5dee•Updated 7 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

@willthereader•Updated 7 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

@robertbrook•Updated 7 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

@CoachCompanion•Updated 7 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

@CoachCompanion•Updated 7 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 }

dailyQuoteAPI

@Souky•Updated 1 day ago

HTTP

@Ncharity•Updated 1 day ago
Daily Quote API
Kapil01
apiv1