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%20%22Image%20title%22?q=fetch&page=1318&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 16237 results for "fetch"(3729ms)

efficientAmberUnicornmain.tsx4 matches

@CoachCompanion•Updated 8 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 8 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 8 months ago
39
40export default async function(req: Request): Promise<Response> {
41 return app.fetch(req);
42}

geminiBboxmain.tsx19 matches

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

BBslackScoutmain.tsx8 matches

@alexdphan•Updated 8 months ago
20 for (const topic of KEYWORDS) {
21 const results = await Promise.allSettled([
22 fetchHackerNewsResults(topic),
23 fetchTwitterResults(topic),
24 fetchRedditResults(topic),
25 ]);
26
49}
50
51// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53 return hackerNewsSearch({
54 query: topic,
58}
59
60async function fetchTwitterResults(topic: string): Promise<Website[]> {
61 return twitterSearch({
62 query: topic,
67}
68
69async function fetchRedditResults(topic: string): Promise<Website[]> {
70 return redditSearch({ query: topic });
71}
84 }
85
86 const response = await fetch(slackWebhookUrl, {
87 method: "POST",
88 headers: { "Content-Type": "application/json" },

falProxyRequestmain.tsx1 match

@stevekrouse•Updated 8 months ago
4 const headers = new Headers(req.headers);
5 headers.set("x-proxy-authorization", `Bearer ${Deno.env.get("valtown")}`);
6 return fetch("https://fal-faltownproxy.web.val.run/api/faltown/proxy", {
7 method,
8 headers,

cerebras_codermain.tsx1 match

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

reqEvaltownmain.tsx1 match

@maxm•Updated 8 months ago
32 const url = new URL("." + pathname, "http://localhost:" + port);
33 url.search = search;
34 const resp = await fetch(url, {
35 method: req.method,
36 headers: req.headers,

readwise-instapaper1 file match

@welson•Updated 2 days ago
Fetches my articles from Readwise. Syncs with/ Neon + Instapaper

manual-fetcher

@miz•Updated 2 weeks ago