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/$%7Bsuccess?q=fetch&page=679&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 8693 results for "fetch"(1669ms)

TanStackBlogToRSSmain.tsx5 matches

@vogelino•Updated 11 months ago
17export default async function(req: Request): Promise<Response> {
18 const url = new URL(`https://tanstack.com/blog`);
19 const html = await fetch(url.toString(), {
20 method: req.method,
21 headers: new Headers({
24 "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
25 "Accept-Language": "en-US,en;q=0.5",
26 "Sec-Fetch-Site": "cross-site",
27 "Sec-Fetch-Mode": "navigate",
28 "Sec-Fetch-User": "?1",
29 "Sec-Fetch-Dest": "document",
30 "Referer": "https://www.google.com/",
31 "sec-ch-ua": `"Not A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"`,

story_wordcountmain.tsx12 matches

@willthereader•Updated 11 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// Define a type for the results that will be fetched
4type FeedResult = {
5 url: string;
8};
9
10// Fetch the HTML content of the given URL
11async function fetchHtml(url: string): Promise<string> {
12 const response = await fetch(url, {
13 method: "GET",
14 headers: {
24
25 if (!response.ok) {
26 throw new Error(`Failed to fetch URL: ${url} - Status: ${response.status}`);
27 }
28
63 try {
64 const cacheBustingUrl = `${feedUrl}&timestamp=${new Date().getTime()}`;
65 const response = await fetch(cacheBustingUrl, {
66 method: "GET",
67 headers: {
77
78 if (!response.ok) {
79 console.error(`Failed to fetch URL: ${feedUrl} - Status: ${response.status}`);
80 continue;
81 }
86 }
87 } catch (error) {
88 console.error(`Error fetching URL: ${feedUrl}`, error);
89 }
90 }
98 const baseUrl = "https://forums.spacebattles.com/search/69363141/?t=post&c[content]=thread&c[users]=3ndless&o=date";
99 try {
100 const html = await fetchHtml(baseUrl);
101 const titles = titleExtractor(html);
102 const feeds = titles.flatMap(urlGenerator);
132 return totalWords;
133 } catch (error) {
134 console.error(`Failed to fetch or parse RSS feed from ${url}:`, error);
135 return null;
136 }
152 //console.log("Useful URLs:", usefulUrls); // Debugging log
153 //return usefulUrls;
154 const wordcount = await fetchAndExtractWordCount(usefulUrls); // Extract word count
155 console.log("Final Word Counts:", wordcount); // Debugging log
156 return wordcount;

prism_feature_notificationsmain.tsx1 match

@kishore•Updated 11 months ago
15
16export default async function(interval: Interval) {
17 const response = await fetch(dictionaryUrl);
18 const { features } = await response.json();
19 const featuresAboveConfidenceThreshold = features.filter(

tanPeacockmain.tsx2 matches

@maxm•Updated 11 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";
133});
134
135export default modifyFetchHandler(passwordAuth(app.fetch));

dailyDadJokemain.tsx2 matches

@zhanziyang•Updated 11 months ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

imgGenUrlmain.tsx2 matches

@andrewgao•Updated 11 months ago
21
22 if (cacheData && cacheData.expiration > Date.now()) {
23 return new Response((await fetch(cacheData.url)).body, { headers: { "content-type": "image/jpg" } });
24 }
25
30 await blob.setJSON(genKey(key), { url, expiration });
31
32 return new Response((await fetch(url)).body, {
33 headers: {
34 "content-type": "image/jpg",

basicAuthButtonmain.tsx1 match

@jdan•Updated 11 months ago
33});
34
35export default app.fetch;

safeMessageBoardmain.tsx1 match

@stevekrouse•Updated 11 months ago
55});
56
57export default valTownBadge(app.fetch, import.meta.url);

aquamarinePiranhamain.tsx1 match

@maxm•Updated 11 months ago
1import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
2const resp = await fetch("https://maxm-wasmblobhost.web.val.run/e5vpzt253pv5jxqfmygo7nytl5uvyn5c.wasm");
3const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
4export default async function(req: Request): Promise<Response> {

compileAndUploadTinygoWasmmain.tsx2 matches

@maxm•Updated 11 months ago
42})();
43
44let resp = await fetch("https://maxm-wasmBlobHost.web.val.run", {
45 method: "POST",
46 headers: {
57
58import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
59const resp = await fetch("${url}");
60const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
61export default async function(req: Request): Promise<Response> {

fetchPaginatedData2 file matches

@nbbaier•Updated 3 weeks ago

FetchBasic1 file match

@fredmoon•Updated 3 weeks ago