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/?q=fetch&page=364&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 7903 results for "fetch"(705ms)

UserSpecificResource_Testmain.tsx1 match

@rozekUpdated 3 months ago
56 for (const TestCase of TestCases) {
57 try {
58 const Response = await fetch(ValURL, { headers:TestCase.Headers })
59 const Body = await Response.text()
60

wallpaperAppmain.tsx2 matches

@BuddhaUpdated 3 months ago
25 const imageUrl = `https://maxm-imggenurl.web.val.run/${safePrompt}`;
26
27 // Prefetch image to ensure it loads
28 const response = await fetch(imageUrl);
29 if (!response.ok) {
30 throw new Error('Failed to generate image');

remasterbackendmain.tsx6 matches

@tempdevUpdated 3 months ago
20}
21
22export async function Fetcher(url: string, referer: string) {
23 const design = `?destination=${encodeURIComponent(url)}&referer=${encodeURIComponent(referer)}`;
24 const request = await fetch(
25 `https://1fd98a05-4959-42bc4-2f83-2c487c1cde6d.cloudflarepreviews.com/${design}`,
26 {
54 };
55 const baseUrl = "https://rapidplayers.com";
56 const embed = await Fetcher(`${baseUrl}/e/${id}`, baseUrl);
57 const pr = /p}\('(.*?)',(\d+),(\d+),'(.*?)'\.split/gm;
58 const ps = /sources:\[{file:\"(.*?)\"/gm;
86 };
87 const baseUrl = "https://d000d.com";
88 const doodData = await Fetcher(`${baseUrl}/e/${id}`, baseUrl);
89 console.log(doodData);
90 const poster = "";
92 const path = doodData.match(/\$\.get\('\/pass_md5([^']+)/)?.[1];
93 const thumbnailTrack = `https:${doodData.match(/thumbnails:\s\{\s*vtt:\s'([^']*)'/)?.[1]}`;
94 const doodPage = await Fetcher(`${baseUrl}/pass_md5${path}`, `${baseUrl}/e/${id}`);
95
96 returnData.extractedURL = `${doodPage}${nanoid()}?token=${dataForLater}&expiry=${Date.now()}`;
117 };
118 const baseUrl = "https://streamtape.com";
119 const embed = await Fetcher(`${baseUrl}/e/${id}`, "");
120 console.log(`${baseUrl}/e/${id}`);
121 const match = embed.match(/robotlink'\)\.innerHTML = '(.*)'/);

primewireUtilsmain.tsx4 matches

@tempdevUpdated 3 months ago
8
9async function search(imdbId: string) {
10 const searchResult = await fetch(`${primewireBase}/api/v1/show?key=${primewireApiKey}&imdb_id=${imdbId}`);
11 return await searchResult.json().then((searchResult) => {
12 return searchResult.id;
56 const searchResult = await search(imdbId);
57 console.log(`${primewireBase}/movie/${searchResult}`);
58 const title = await fetch(`${primewireBase}/movie/${searchResult}`);
59 const titleResp = await title.text();
60 const embeds = await getStreams(titleResp);
69 const searchResult = await search(imdbId);
70
71 const _season = await fetch(`${primewireBase}/tv/${searchResult}`, {});
72 const season = await _season.text();
73 const seasonPage = load(season);
81 if (!episodeLink) throw new NotFoundError("No episode links found");
82
83 const _title = await fetch(`${primewireBase}/${episodeLink}`);
84 const title = await _title.text();
85 const embeds = await getStreams(title);

sqliteExplorerAppmain.tsx4 matches

@caizoryanUpdated 3 months ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

receiveAndSavePointsmain.tsx1 match

@caizoryanUpdated 3 months ago
50});
51
52export default app.fetch;

react_client_forkmain.tsx5 matches

@charmaineUpdated 3 months ago
14 setNewTodo("");
15 // Sending new todo to server
16 await fetch('/add-todo', {
17 method: 'POST',
18 headers: {
27 setTodos(updatedTodos);
28 // Optionally, update server
29 await fetch('/delete-todo', {
30 method: 'POST',
31 headers: {
110
111function client() {
112 const fetchTodos = async () => {
113 const response = await fetch('/todos');
114 const todos = await response.json();
115 return todos;
116 };
117
118 fetchTodos().then(initialTodos => {
119 createRoot(document.getElementById("root")).render(<App initialTodos={initialTodos} />);
120 });

sitesUptimeMonitormain.tsx2 matches

@przeprogramowaniUpdated 3 months ago
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

weatherBasedActivityAlertingmain.tsx3 matches

@mattwd7Updated 3 months ago
62 forecastUrl.searchParams.set("forecast_days", "7");
63
64 const forecastResponse = await fetch(forecastUrl.toString());
65
66 if (!forecastResponse.ok) {
146 await email({
147 subject: "❌ Weather Forecast Error",
148 text: `An error occurred while fetching the weather forecast: ${error.message}`,
149 html: `
150 <h2>Weather Forecast Error</h2>
151 <p>An error occurred while fetching the weather forecast:</p>
152 <pre>${error.message}</pre>
153 <p><a href="${import.meta.url.replace("esm.town", "val.town")}" target="_top">View Val Source</a></p>

blob_adminmain.tsx23 matches

@yeikoUpdated 3 months ago
234 const [isDragging, setIsDragging] = useState(false);
235
236 const fetchBlobs = useCallback(async () => {
237 setLoading(true);
238 try {
239 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240 const data = await response.json();
241 setBlobs(data);
242 } catch (error) {
243 console.error("Error fetching blobs:", error);
244 } finally {
245 setLoading(false);
248
249 useEffect(() => {
250 fetchBlobs();
251 }, [fetchBlobs]);
252
253 const handleSearch = (e) => {
264 setBlobContentLoading(true);
265 try {
266 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267 const content = await response.text();
268 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
269 setEditContent(content);
270 } catch (error) {
271 console.error("Error fetching blob content:", error);
272 } finally {
273 setBlobContentLoading(false);
278 const handleSave = async () => {
279 try {
280 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281 method: "PUT",
282 body: editContent,
290 const handleDelete = async (key) => {
291 try {
292 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293 setBlobs(blobs.filter(b => b.key !== key));
294 if (selectedBlob && selectedBlob.key === key) {
307 const key = `${searchPrefix}${file.name}`;
308 formData.append("key", encodeKey(key));
309 await fetch("/api/blob", { method: "POST", body: formData });
310 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311 setBlobs([newBlob, ...blobs]);
315 }
316 }
317 fetchBlobs();
318 };
319
329 try {
330 const fullKey = `${searchPrefix}${key}`;
331 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332 method: "PUT",
333 body: "",
344 const handleDownload = async (key) => {
345 try {
346 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347 const blob = await response.blob();
348 const url = window.URL.createObjectURL(blob);
363 if (newKey && newKey !== oldKey) {
364 try {
365 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366 const content = await response.blob();
367 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368 method: "PUT",
369 body: content,
370 });
371 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373 if (selectedBlob && selectedBlob.key === oldKey) {
383 const newKey = `__public/${key}`;
384 try {
385 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386 const content = await response.blob();
387 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388 method: "PUT",
389 body: content,
390 });
391 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393 if (selectedBlob && selectedBlob.key === key) {
402 const newKey = key.slice(9); // Remove "__public/" prefix
403 try {
404 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405 const content = await response.blob();
406 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407 method: "PUT",
408 body: content,
409 });
410 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412 if (selectedBlob && selectedBlob.key === key) {
826});
827
828export default lastlogin((request: Request) => app.fetch(request));

fetchPaginatedData2 file matches

@nbbaierUpdated 1 week ago

FetchBasic1 file match

@fredmoonUpdated 1 week ago