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=511&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 8288 results for "fetch"(1403ms)

perseveringAmaranthChipmunkmain.tsx4 matches

@dnakhooda•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

uploadImagemain.tsx2 matches

@ajsol•Updated 5 months ago
10 image,
11 );
12 const data = await (await fetch(await getUploadURL(), {
13 "body": fd,
14 "method": "POST",
24}
25async function getUploadURL(): Promise<string> {
26 const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27 "headers": {
28 "content-type": "application/json",

sanguineAquaReptilemain.tsx2 matches

@stevekrouse•Updated 5 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

affableMagentaPlanarianmain.tsx15 matches

@willthereader•Updated 5 months ago
51}
52
53// Link Fetching Helper
54export class LinkFetcher {
55 static filteredUrls = [];
56
60 }
61
62 static async fetchLinksFromWebsite(websiteUrl) {
63 currentProgress = {
64 phase: "fetching",
65 processedPages: 0,
66 totalLinks: 0,
74 while (pagesToProcess.length > 0) {
75 currentProgress = {
76 phase: "fetching",
77 processedPages: processedPages.size,
78 totalLinks: allLinks.size,
86
87 try {
88 const response = await fetch(pageUrl, {
89 headers: {
90 "User-Agent":
134 } catch (error) {
135 console.error(`Error processing page ${pageUrl}:`, error);
136 this.logFilteredUrl(pageUrl, `Fetch error: ${error.message}`);
137 }
138 });
218 for (let attempt = 0; attempt < retries; attempt++) {
219 try {
220 const response = await fetch(url, {
221 method: "GET",
222 headers: {
362export async function findBrokenLinks(websiteUrl) {
363 try {
364 const links = await LinkFetcher.fetchLinksFromWebsite(websiteUrl);
365 const totalPages = new Set(links.map(link =>
366 new URL(link.link, websiteUrl).origin + new URL(link.link, websiteUrl).pathname
376 linkChecker.getElapsedTime(),
377 totalPages,
378 LinkFetcher.filteredUrls,
379 );
380 } catch (error) {
397 intervalId = setInterval(async () => {
398 try {
399 const response = await fetch("/api/progress");
400 if (!response.ok) {
401 throw new Error(`HTTP error! status: ${response.status}`);
413 }
414 } catch (e) {
415 console.error("Error fetching progress:", e);
416 setError(`Error fetching progress: ${e.message}`);
417 }
418 }, 1000);
429 setBrokenLinks([]);
430 try {
431 const response = await fetch("/api/check-links", {
432 method: "POST",
433 headers: {
478 <h2>Progress</h2>
479 <p>Phase: {progress.phase}</p>
480 {progress.phase === "fetching" && (
481 <p>
482 Processed Pages: {progress.processedPages}

methodicalOliveSparrowmain.tsx2 matches

@temptemp•Updated 5 months ago
1/** @jsxImportSource npm:hono/jsx */
2import { blob } from "https://esm.town/v/std/blob";
3import { fetch } from "https://esm.town/v/std/fetch";
4import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
5import { pushRandomData, schedulePurge, schedulePush, scheduleRead } from "https://esm.town/v/temptemp/radiodb";
73
74// Export the app
75export default app.fetch;

setsignsmain.tsx1 match

@kora•Updated 5 months ago
32 return c.json(result);
33});
34export default app.fetch;

ambitiousBronzeBandicootmain.tsx10 matches

@stanley•Updated 5 months ago
23}
24
25async function fetchAndCacheData() {
26 try {
27 console.log("Fetching URL:", url);
28 const response = await fetch(url, {
29 headers: {
30 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
56 return bootstrapData;
57 } catch (error) {
58 console.error("Error fetching and caching data:", error);
59 const cachedData = await blob.getJSON(cacheKey);
60 if (cachedData) {
61 console.log("Using cached data from:", cachedData.timestamp);
62 return { ...cachedData.data, _cachedAt: cachedData.timestamp, _cacheNotice: "This is cached data. Live fetching failed." };
63 }
64 throw error;
67
68async function getFullData() {
69 const data = await fetchAndCacheData();
70 return Response.json(data);
71}
72
73async function getDonationProgress() {
74 const data = await fetchAndCacheData();
75 const donationGoal = data.checkoutLink.checkout_link_data.donation_goal;
76 return Response.json({
86
87async function getCheckoutDetails() {
88 const data = await fetchAndCacheData();
89 return Response.json({
90 checkoutTitle: data.checkoutTitle,
95
96async function getCampaignInfo() {
97 const data = await fetchAndCacheData();
98 const linkData = data.checkoutLink.checkout_link_data;
99 return Response.json({
106
107async function getHtmlView() {
108 const data = await fetchAndCacheData();
109 const linkData = data.checkoutLink.checkout_link_data;
110 const donationGoal = linkData.donation_goal;

prompt_to_code_auto_refresh_codebedmain.tsx1 match

@trob•Updated 5 months ago
30 setIsLoading(true);
31 try {
32 const response = await fetch("/generate", {
33 method: "POST",
34 headers: { "Content-Type": "application/json" },

gptmemorymain.tsx1 match

@toowired•Updated 5 months ago
919 });
920
921 return app.fetch(req);
922};

professionalFuchsiaSmeltmain.tsx4 matches

@yuxuan•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago