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/image-url.jpg?q=fetch&page=159&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 10229 results for "fetch"(614ms)

FirstProjectindex.js21 matches

@MiracleSanctuary•Updated 1 week ago
55};
56
57// Fetch job listings
58const fetchJobs = async () => {
59 try {
60 const response = await fetch('/api/jobs');
61 if (!response.ok) throw new Error('Failed to fetch jobs');
62
63 const jobs = await response.json();
81 `).join('');
82 } catch (error) {
83 console.error('Error fetching jobs:', error);
84 jobListings.innerHTML = '<p class="text-red-500">Failed to load jobs. Please try again later.</p>';
85 }
104 };
105
106 const response = await fetch('/api/jobs', {
107 method: 'POST',
108 headers: {
119 // Reset form and refresh job listings
120 jobForm.reset();
121 await fetchJobs();
122
123 // Show success message
132});
133
134// Fetch chat messages
135const fetchChatMessages = async () => {
136 try {
137 const response = await fetch('/api/chat');
138 if (!response.ok) throw new Error('Failed to fetch chat messages');
139
140 const messages = await response.json();
166 chatMessages.scrollTop = chatMessages.scrollHeight;
167 } catch (error) {
168 console.error('Error fetching chat messages:', error);
169 chatMessages.innerHTML = '<p class="text-red-500">Failed to load messages. Please try again later.</p>';
170 }
188 document.getElementById('message').focus();
189
190 // Fetch messages and start polling
191 fetchChatMessages();
192 startPolling();
193});
202
203 try {
204 const response = await fetch('/api/chat', {
205 method: 'POST',
206 headers: {
218 }
219
220 // Clear input and fetch new messages
221 messageInput.value = '';
222 await fetchChatMessages();
223 } catch (error) {
224 console.error('Error sending message:', error);
231 if (pollingInterval) clearInterval(pollingInterval);
232
233 pollingInterval = setInterval(fetchChatMessages, 3000);
234};
235
243const init = async () => {
244 setViewSourceLink();
245 await fetchJobs();
246
247 // If on chat tab and username is set, fetch messages and start polling
248 if (currentUsername && !chatContent.classList.contains('hidden')) {
249 await fetchChatMessages();
250 startPolling();
251 }

FirstProjectchat.ts2 matches

@MiracleSanctuary•Updated 1 week ago
12 return c.json(messages);
13 } catch (error) {
14 console.error("Error fetching chat messages:", error);
15 return c.json({ error: "Failed to fetch chat messages" }, 500);
16 }
17});

FirstProjectjobs.ts2 matches

@MiracleSanctuary•Updated 1 week ago
11 return c.json(jobPostings);
12 } catch (error) {
13 console.error("Error fetching job postings:", error);
14 return c.json({ error: "Failed to fetch job postings" }, 500);
15 }
16});

lyristmain.ts12 matches

@g•Updated 1 week ago
32
33 try {
34 // 1. Fetch suggestions
35 const suggestUrl = `https://api.lyrics.ovh/suggest/${encodeURIComponent(query)}`;
36 console.log(`Fetching suggestions from: ${suggestUrl}`);
37 const suggestResponse = await fetch(suggestUrl);
38
39 if (!suggestResponse.ok) {
40 console.error(`Error fetching suggestions: ${suggestResponse.status} ${suggestResponse.statusText}`);
41 const errorBody = await suggestResponse.text();
42 console.error(`Error body: ${errorBody}`);
43 return c.json({ error: 'Failed to fetch song suggestions', details: errorBody }, suggestResponse.status);
44 }
45
58 console.log(`Found song: Title - ${actualTitle}, Artist - ${actualArtist}`);
59
60 // 3. Fetch lyrics
61 const lyricsUrl = `https://api.lyrics.ovh/v1/${encodeURIComponent(actualArtist)}/${encodeURIComponent(actualTitle)}`;
62 console.log(`Fetching lyrics from: ${lyricsUrl}`);
63 const lyricsResponse = await fetch(lyricsUrl);
64
65 if (!lyricsResponse.ok) {
66 console.error(`Error fetching lyrics: ${lyricsResponse.status} ${lyricsResponse.statusText}`);
67 const errorBody = await lyricsResponse.text();
68 console.error(`Error body: ${errorBody}`);
72 return c.json({ error: errorJson.error || 'Lyrics not found for this song' }, 404);
73 }
74 return c.json({ error: 'Failed to fetch lyrics', details: errorBody }, lyricsResponse.status);
75 }
76
125});
126
127// Export the fetch handler for the worker
128export default app.fetch;

JobPlatformindex.ts1 match

@MiracleSanctuary•Updated 1 week ago
41
42// This is the entry point for HTTP vals
43export default app.fetch;

JobPlatformapp.js8 matches

@MiracleSanctuary•Updated 1 week ago
85async function loadJobs() {
86 try {
87 const response = await fetch('/api/jobs');
88 if (!response.ok) throw new Error('Failed to fetch jobs');
89
90 const jobs = await response.json();
120 };
121
122 const response = await fetch('/api/jobs', {
123 method: 'POST',
124 headers: {
187async function loadChatMessages() {
188 try {
189 const response = await fetch('/api/chat');
190 if (!response.ok) throw new Error('Failed to fetch chat messages');
191
192 const messages = await response.json();
235 if (lastChatTimestamp) {
236 try {
237 const response = await fetch(`/api/chat/recent?since=${lastChatTimestamp}`);
238 if (!response.ok) throw new Error('Failed to fetch recent messages');
239
240 const newMessages = await response.json();
278
279 try {
280 const response = await fetch('/api/chat', {
281 method: 'POST',
282 headers: {

JobPlatformchat.ts4 matches

@MiracleSanctuary•Updated 1 week ago
12 return c.json(messages);
13 } catch (error) {
14 console.error("Error fetching chat messages:", error);
15 return c.json({ error: "Failed to fetch chat messages" }, 500);
16 }
17});
28 return c.json(messages);
29 } catch (error) {
30 console.error("Error fetching recent chat messages:", error);
31 return c.json({ error: "Failed to fetch recent chat messages" }, 500);
32 }
33});

JobPlatformjobs.ts4 matches

@MiracleSanctuary•Updated 1 week ago
11 return c.json(jobsList);
12 } catch (error) {
13 console.error("Error fetching jobs:", error);
14 return c.json({ error: "Failed to fetch jobs" }, 500);
15 }
16});
31 return c.json(job);
32 } catch (error) {
33 console.error("Error fetching job:", error);
34 return c.json({ error: "Failed to fetch job" }, 500);
35 }
36});

lyristlyricsProcessor.ts8 matches

@g•Updated 1 week ago
23*/
24
25import { fetch as proxiedFetch } from "https://esm.town/v/std/fetch";
26import * as cheerio from "npm:cheerio";
27import { fetchLyricsMetadata } from "./lyrics";
28
29/**
55 }
56
57 const res = await fetchLyricsMetadata(query);
58
59 if (res.status === 200 && res.url !== "Not found") {
63 "Accept-Language": "en-US,en;q=0.9",
64 "Cache-Control": "max-age=0",
65 "Sec-Fetch-Dest": "document",
66 "Sec-Fetch-Mode": "navigate",
67 "Sec-Fetch-Site": "none",
68 "Sec-Fetch-User": "?1",
69 "Sec-Gpc": "1",
70 "Upgrade-Insecure-Requests": "1",
80 }
81
82 const response = await fetch(res.url, { headers: headers });
83 const targetHtml = await response.text();
84 let $ = cheerio.load(targetHtml);

lyristlyrics.ts3 matches

@g•Updated 1 week ago
23*/
24
25import { fetch as proxiedFetch } from "https://esm.town/v/std/fetch";
26
27interface LyricsResponse {
53}
54
55export const fetchLyricsMetadata = async (
56 searchTerm: string,
57): Promise<LyricsResponse> => {
73
74 // Make the API request
75 const response = await proxiedFetch(target, { headers });
76 const data = await response.json();
77

agentplex-deal-flow-email-fetch1 file match

@anandvc•Updated 4 days ago

proxyFetch2 file matches

@vidar•Updated 1 week ago