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=641&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 7615 results for "fetch"(1698ms)

runGistmain.tsx2 matches

@pomdtr•Updated 1 year ago
1import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=42";
3
4export default async function (req: Request) {
27 }
28
29 const gist = await fetchJSON(`https://api.github.com/gists/${id}`);
30 if (gist.owner.login != author) {
31 return new Response("Unauthorized", {

untitled_cyanLampreymain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { timed } from "https://esm.town/v/stevekrouse/timed";
4
5const dateme_html_cache = await (await fetch("https://stevekrouse-dateme.web.val.run/")).text();
6
7await blob.delete("dateme_html_cache");

check_hfsmain.tsx2 matches

@rejetto•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2export default async function(req: Request): Promise<Response> {
3 const p = Object.fromEntries(new URL(req.url).searchParams);
4 if (!p.url) return Response.json("missing url");
5 console.log("checking", p.url);
6 const res = await fetch(p.url);
7 if (!res.ok) return Response.json(res.status);
8 const txt = await res.text();

gptMemoryManagermain.tsx1 match

@xkonti•Updated 1 year ago
458 });
459
460 return app.fetch(req);
461};

youtubeEndpointmain.tsx10 matches

@syncretizm•Updated 1 year ago
2import { YouTube } from 'https://deno.land/x/youtube@v0.3.0/mod.ts';
3
4export async function fetchVideoDetails(req) {
5 const url = new URL(req.url);
6 let yturl = url.searchParams.get("yturl") || "";
29
30 try {
31 let response = await fetch(apiUrl);
32 let data = await response.json();
33 if (!data.items || data.items.length === 0) {
84 const categoryId = item.snippet.categoryId;
85 apiUrl = `https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&id=${categoryId}&key=${apiKey}`;
86 response = await fetch(apiUrl);
87 data = await response.json();
88 const category = data.items && data.items.length > 0 ? data.items[0].snippet.title : 'N/A';
94 break;
95 case 'transcript':
96 async function fetchcaptions(videoId) {
97 const WATCH_URL = `https://www.youtube.com/watch?v=${videoId}`;
98
99 try {
100 const response = await fetch(WATCH_URL);
101 const html = await response.text();
102 const jsonMatch = html.match(/"captions":({.*?}), "videoDetails"/);
110
111 const captionsUrl = captionsJson.captionTracks[0].baseUrl;
112 const captionsResponse = await fetch(captionsUrl);
113 const captionsText = await captionsResponse.text();
114 return captionsText;
115 } catch (error) {
116 console.error('Failed to fetch Youtube captions:', error);
117 throw error;
118 }
119 }
120
121 fetchcaptions(videoId).then(captions => {
122 return new Response(captions);
123 }).catch(error => {
124 console.error('Error fetching captions:', error)
125 });
126
130 return new Response(responseContent);
131 } catch (error) {
132 console.error("Error fetching video details:", error);
133 throw error;
134 }

untitled_ivoryFishmain.tsx4 matches

@bryanb9•Updated 1 year ago
1import { hamptonzachary29@gmail.com} 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;

isMyWebsiteDownmain.tsx3 matches

@ktm•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export const isMyWebsiteDown = async () => {
11 try {
12 const start = Date.now();
13 const res = await fetch(URL);
14 const millisecondsSpent = Date.now() - start;
15 const jsonData = await res.json();
25 }
26 catch (e) {
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }

clerk_hono_pocmain.tsx1 match

@saolsen•Updated 1 year ago
111 }
112});
113export default app.fetch;

untitled_apricotParrotfishmain.tsx1 match

@steveVT•Updated 1 year ago
11app.get("/edit/:blob", async (c) => c.html(`TODO: Edit ${c.req.param("blob")}`));
12app.get("/delete/:blob", async (c) => c.html(`TODO: Delete ${c.req.param("blob")}`));
13export default basicAuth(app.fetch);

untitled_indigoNightingalemain.tsx1 match

@stevekrouse•Updated 1 year ago
11app.get("/edit/:blob", async (c) => c.html(`TODO: Edit ${c.req.param("blob")}`));
12app.get("/delete/:blob", async (c) => c.html(`TODO: Delete ${c.req.param("blob")}`));
13export default basicAuth(app.fetch);

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago