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=123&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 9526 results for "fetch"(1345ms)

subdomainsaiml.tsx1 match

@rayyan•Updated 1 week ago
5app.get("/", c => c.text("aiml \nsub-domain secured"));
6
7export default app.fetch;

subdomainsbro.tsx1 match

@rayyan•Updated 1 week ago
5app.get("/", c => c.text("bro \nsub-domain secured"));
6
7export default app.fetch;

subdomainsrayyan.tsx1 match

@rayyan•Updated 1 week ago
5app.get("/", c => c.text("rayyan \nsub-domain secured"));
6
7export default app.fetch;

subdomainsryan.tsx1 match

@rayyan•Updated 1 week ago
5app.get('/', c=> c.text("ryan \nsub-domain secured"))
6
7export default app.fetch

cyberprankfile-rename.tsx1 match

@rayyan•Updated 1 week ago
51});
52
53export default app.fetch;

Townieusage-dashboard.ts3 matches

@valdottown•Updated 1 week ago
59 // If we get here, authentication was successful
60
61 // Fetch all rows from the usage table
62 // Fetch all rows from the usage table
63 const allUsageData = await sqlite.execute(`SELECT * FROM ${USAGE_TABLE} ORDER BY timestamp DESC`);
64
65 // Fetch aggregated data grouped by user_id
66 const groupedUsageData = await sqlite.execute(`
67 SELECT

glastonewsindex.ts29 matches

@bensomething•Updated 1 week ago
1import fetch from "npm:node-fetch";
2import process from "node:process";
3import { BskyAgent } from "npm:@atproto/api";
8});
9
10// ======= Fetch HTML with Improved Retry =======
11async function fetchHtmlWithRetry(url, options = {}, retries = 5, delay = 1000) {
12 for (let i = 0; i < retries; i++) {
13 try {
15 const timeoutId = setTimeout(() => controller.abort(), 15000);
16
17 const response = await fetch(url, {
18 ...options,
19 signal: controller.signal,
28
29 if (!response.ok) {
30 throw new Error(`Failed to fetch: ${response.statusText}`);
31 }
32
39 if (isPrematureClose && i < retries - 1) {
40 console.warn(
41 `Fetch attempt ${i + 1} failed during .text() with "Premature close". Retrying immediately...`,
42 );
43 continue;
44 } else if (i < retries - 1) {
45 console.warn(
46 `Fetch attempt ${i + 1} failed during .text(). Retrying in ${delay}ms...`,
47 );
48 await new Promise((resolve) => setTimeout(resolve, delay));
57 if (isPrematureClose && i < retries - 1) {
58 console.warn(
59 `Fetch attempt ${i + 1} failed with "Premature close". Retrying immediately...`,
60 );
61 continue;
62 } else if (i < retries - 1) {
63 console.warn(`Fetch attempt ${i + 1} failed. Retrying in ${delay}ms...`);
64 await new Promise((resolve) => setTimeout(resolve, delay));
65 } else {
70}
71
72// ======= Fetch News =======
73async function fetchNews() {
74 const url = "https://glastonburyfestivals.co.uk/news/";
75 try {
76 const html = await fetchHtmlWithRetry(url);
77 const $ = cheerio.load(html);
78
88 return news;
89 } catch (error) {
90 console.error("Error fetching news:", error);
91 throw error;
92 }
93}
94
95// ======= Fetch Your Own Recent Bluesky Post Titles =======
96async function fetchOwnRecentPostTitles(agent, handle, limit = 100) {
97 const feed = await agent.getAuthorFeed({ actor: handle, limit });
98 return feed.data.feed.map(item => item.post.record.text);
99}
100
101// ======= Fetch Embed Data =======
102async function fetchEmbedData(url) {
103 try {
104 const html = await fetchHtmlWithRetry(url);
105 const $ = cheerio.load(html);
106
116 imageUrl = new URL(imageUrl, url).href;
117 }
118 console.log("Fetching image for URL:", imageUrl);
119
120 // For images, use the original fetchWithRetry (no .text() call)
121 const imgResponse = await fetchHtmlWithRetry(imageUrl);
122 // However, for images, we need the raw bytes, so use fetchWithRetry as before:
123 const imgResponseRaw = await fetch(imageUrl, {
124 headers: {
125 "User-Agent": "Mozilla/5.0 (compatible; MyNewsBot/1.0; +https://yourdomain.example/contact)",
162 };
163 } catch (error) {
164 console.error("Error fetching embed data:", error);
165 return null;
166 }
177
178 const myHandle = process.env.BLUESKY_USERNAME; // e.g. "yourname.bsky.social"
179 const postedTitlesArr = await fetchOwnRecentPostTitles(agent, myHandle, 100);
180 const postedTitles = new Set(postedTitlesArr);
181
182 const newsItems = await fetchNews();
183 console.log(`Fetched ${newsItems.length} news items.`);
184
185 // Find all news items not yet posted, in chronological order (oldest first)
190 console.log(`Attempting to post new news: ${latestNews.title}`);
191
192 const embedData = await fetchEmbedData(latestNews.link);
193 if (!embedData) {
194 console.error("Failed to fetch embed data. Skipping post.");
195 continue;
196 }

templateTwitterAlertmain.tsx1 match

@noumanshakeel82•Updated 1 week ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

testtownieindex.ts1 match

@charmaine•Updated 1 week ago
39
40// Export the Hono app for HTTP val
41export default app.fetch;

testtownieindex.tsx8 matches

@charmaine•Updated 1 week ago
35
36 React.useEffect(() => {
37 async function fetchPosts() {
38 try {
39 const response = await fetch('/api/posts');
40 if (!response.ok) {
41 throw new Error('Failed to fetch posts');
42 }
43 const data = await response.json();
51 }
52
53 fetchPosts();
54 }, []);
55
82
83 React.useEffect(() => {
84 async function fetchPost() {
85 if (!slug) return;
86
87 try {
88 const response = await fetch(`/api/posts/${slug}`);
89 if (response.status === 404) {
90 navigate('/not-found');
92 }
93 if (!response.ok) {
94 throw new Error('Failed to fetch post');
95 }
96 const data = await response.json();
104 }
105
106 fetchPost();
107 }, [slug, navigate]);
108

agentplex-deal-flow-email-fetch1 file match

@anandvc•Updated 8 hours ago

proxyFetch2 file matches

@vidar•Updated 2 days ago