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/$%7Bart_info.art.src%7D?q=fetch&page=793&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 10997 results for "fetch"(1194ms)

rabbitstreammain.tsx2 matches

@temptemp•Updated 6 months ago
29 getSourcesParams.append("b", browserid);
30 console.log(getSourcesParams);
31 const result = await fetch(
32 `https://rabbitstream.net/ajax/v2/embed-4/getSources?${getSourcesParams.toString()}`,
33 {
49});
50
51export default app.fetch;

otherBrokenURLhandlermain.tsx11 matches

@willthereader•Updated 7 months ago
44}
45
46// Link Fetching Helper
47export class LinkFetcher {
48 static discoveredUrls = new Set();
49 static pageDepths = new Map();
50 static processQueue = [];
51 static async fetchLinksFromWebsite(websiteUrl) {
52 console.log(`\nFetching links from website: ${websiteUrl}`);
53 const discoveredPages = new Set([websiteUrl]);
54 const pagesToProcess = [websiteUrl];
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
78 if (!response.ok) {
79 console.log(`Failed to fetch links from ${pageUrl}`);
80 return [];
81 }
110 }
111
112 console.log(`Successfully fetched ${allLinks.length} links from ${discoveredPages.size} pages`);
113 return allLinks;
114 }
154 try {
155 console.log(`Attempting HEAD request for: ${url}`);
156 const response = await fetch(url, { method: 'HEAD' });
157
158 if (!response.ok) {
159 console.log(`HEAD request failed, attempting GET request for: ${url}`);
160 const getResponse = await fetch(url, { method: 'GET' });
161 return { ok: getResponse.ok, status: getResponse.status };
162 }
307 };
308
309 // Fetch all links with progress tracking
310 const links = await LinkFetcher.fetchLinksFromWebsite(websiteUrl);
311 const totalPages = new Set(links.map(link => new URL(link.link, websiteUrl).origin + new URL(link.link, websiteUrl).pathname)).size;
312

cerebras_codermain.tsx1 match

@chadparker•Updated 7 months ago
23
24 try {
25 const response = await fetch("/", {
26 method: "POST",
27 body: JSON.stringify({ prompt, currentCode: code }),

curiousTurquoiseDormousemain.tsx5 matches

@CoachCompanion•Updated 7 months ago
51 setTrainingPlan("");
52 setYoutubeLinks([]);
53 const response = await fetch("/generate-training", {
54 method: "POST",
55 headers: { "Content-Type": "application/json", "Regenerate-Key": regenerateKey.toString() },
76 setSharing(true);
77 try {
78 const response = await fetch("/share-training", {
79 method: "POST",
80 headers: { "Content-Type": "application/json" },
718 const videoPlaceholders = trainingPlan.match(/\[VIDEO: .+?\]/g) || [];
719
720 // Fetch and embed YouTube videos
721 const youtubeLinks = [];
722 for (const placeholder of videoPlaceholders) {
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) {
819 }
820 } catch (error) {
821 console.error("Error fetching from YouTube API:", error);
822 }
823 }

efficientAmberUnicornmain.tsx4 matches

@CoachCompanion•Updated 7 months ago
25 const videoPlaceholders = trainingPlan.match(/\[VIDEO: .+?\]/g) || [];
26
27 // Fetch and embed YouTube videos
28 const youtubeLinks = [];
29 for (const placeholder of videoPlaceholders) {
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) {
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();
66 if (videoData.items && videoData.items.length > 0) {
78 }
79 } catch (error) {
80 console.error("Error fetching from YouTube API:", error);
81 }
82 }

pageshotmain.tsx3 matches

@all•Updated 7 months ago
64
65 console.log(">>>> Data", data)
66 const response = await fetch(pipeline_url, {
67 method: "POST",
68 headers: {
296 }
297
298 const response = await fetch('/pageshot', {
299 method: 'POST',
300 headers: {
550app.post("/pageshot", pageshotHandler);
551
552export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
553

renderHTMLWithHonomain.tsx1 match

@daisuke•Updated 7 months ago
39
40export default async function(req: Request): Promise<Response> {
41 return app.fetch(req);
42}

geminiBboxmain.tsx19 matches

@yawnxyz•Updated 7 months ago
62 }
63
64 // Combined function to fetch and handle images
65 async function fetchImage(url, options = {}) {
66 const { returnType = 'blob' } = options;
67
68 console.log("fetchImage url:", url);
69 if (!url) return null;
70
71 try {
72 // Try direct fetch first
73 const response = await fetch(url, {
74 mode: 'no-cors',
75 headers: { 'Accept': 'image/*' }
76 });
77
78 console.log("fetchImage response:", response)
79
80 if (response.ok) {
83 }
84
85 // If direct fetch fails, try our own CORS proxy
86 console.log("Direct fetch failed, trying CORS proxy");
87 const proxyUrl = "/proxy/" + encodeURIComponent(url);
88 console.log("proxyUrl", proxyUrl)
89 const proxyResponse = await fetch(proxyUrl);
90
91 if (!proxyResponse.ok) {
92 throw new Error('Failed to fetch image through CORS proxy');
93 }
94
97
98 } catch (error) {
99 console.error('Error fetching image:', error);
100 throw new Error('Failed to fetch image: ' + error.message);
101 }
102 }
103
104 // Update the image preview function to use the combined fetchImage
105 async function updateImagePreview(url) {
106 const imageContainer = document.getElementById('imageContainer');
112
113 try {
114 const objectUrl = await fetchImage(url, { returnType: 'preview' });
115 if (!objectUrl) {
116 throw new Error('Failed to load image');
363 } else if (urlInput.value) {
364 try {
365 imageFile = await fetchImage(urlInput.value);
366 } catch (error) {
367 alert('Error loading image from URL: ' + error.message);
675 } else if (urlInput.value) {
676 try {
677 imageFile = await fetchImage(urlInput.value);
678 } catch (error) {
679 alert('Error loading image from URL: ' + error.message);
989
990 try {
991 const response = await fetch(url, {
992 headers: {
993 'Accept': 'image/*',
1002 headers: Object.fromEntries(response.headers.entries())
1003 });
1004 return c.text(`Failed to fetch: ${response.statusText}`, response.status);
1005 }
1006
1019});
1020
1021export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
1022
1023

countermain.tsx3 matches

@yawnxyz•Updated 7 months ago
288
289 async function tokenize() {
290 const response = await fetch('/tokenize', {
291 method: 'POST',
292 headers: {
480}
481
482// Export app.fetch for Val Town, otherwise export app — this is only for hono apps
483export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
484

fullWebsiteVersionmain.tsx4 matches

@willthereader•Updated 7 months ago
11 console.log(`Checking URL: ${url}`);
12 try {
13 const response = await fetch(url, { method: "HEAD" });
14
15 if (!response.ok) {
16 console.log(`Attempting GET request as fallback for: ${url}`);
17 const getResponse = await fetch(url, { method: "GET" });
18 return { ok: getResponse.ok, status: getResponse.status };
19 }
72 `;
73
74 const lsdResponse = await fetch(
75 `https://lsd.so/api?query=${encodeURIComponent(query)}`,
76 );
80
81 if (!lsdResponse.ok) {
82 console.error(`Failed to fetch links from ${currentUrl}`);
83 continue;
84 }

HN-fetch-call3 file matches

@ImGqb•Updated 1 day ago
fetch HackerNews by API

FRAMERFetchBasic1 file match

@bresnik•Updated 3 days ago