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=628&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 8476 results for "fetch"(1500ms)

cheerioScrapermain.tsx1 match

@damidina•Updated 10 months ago
5
6export default async function scrapeWebsite(url: string) {
7 const response = await fetch(url);
8 const body = await response.text();
9 const $ = cheerio.load(body);

valTownChatGPT2main.tsx3 matches

@janpaul123•Updated 10 months ago
210 form.addEventListener("submit", (e) => {
211 e.preventDefault();
212 // make fetch POST request to /save and write the result to .saveValResult.
213 fetch("/save", {
214 method: "POST",
215 body: new FormData(form),
306});
307
308export default passwordAuth(app.fetch, { verifyPassword: verifyToken });

valwriter_outputmain.tsx2 matches

@stevekrouse•Updated 10 months ago
8
9app.get("/", async (c) => {
10 const response = await fetch(
11 `${BASE_URL}?q=Brooklyn&units=metric&appid=${WEATHER_API_KEY}`
12 );
20});
21
22export default app.fetch;

downloadSiteContentsmain.tsx2 matches

@nvie•Updated 10 months ago
25 let reason: string;
26 try {
27 res = await fetch(URL, { redirect: "follow" });
28 if (!res.ok) {
29 throw await res.text();
31 ok = true;
32 } catch (e) {
33 reason = `couldn't fetch: ${e}`;
34 await email({ subject: "could not update the contents of the change", text: reason });
35 }

azureDinosaurmain.tsx2 matches

@maxm•Updated 10 months ago
1import { fetchFile, toBlobURL } from "https://esm.sh/@ffmpeg/util";
2import { FFmpeg } from "https://maxm-emeraldox.web.val.run/@ffmpeg/ffmpeg";
3
8 wasmURL: `https://esm.sh/@ffmpeg/core@0.12.6/dist/umd/ffmpeg-core.wasm`,
9});
10console.log(FFmpeg, fetchFile, toBlobURL);

valwriter_outputmain.tsx2 matches

@janpaul123•Updated 10 months ago
1// This approach fetches weather data for Brooklyn, NY from the Open Meteo API
2
3// It then parses the response to extract the current temperature
6
7export default async function main() {
8 // Fetch weather data for Brooklyn, NY
9
10 const response = await axios.get(

citiesmain.tsx1 match

@mxdvl•Updated 10 months ago
30 });
31
32 const { results: [first] } = await fetch(`https://api.opencagedata.com/geocode/v1/json?${searchParams}`)
33 .then(response => response.json())
34 .then(json => parse(schema, json))

notifymain.tsx2 matches

@hlobil•Updated 10 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
17 }
18
19 const resp = await fetch("https://api.pushover.net/1/messages.json", {
20 headers: {
21 "Content-Type": "application/json",

sqlite_adminmain.tsx1 match

@johnsmith•Updated 10 months ago
9app.get("/", async (c) => c.html(await sqlite_admin_tables()));
10app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
11export default basicAuth(app.fetch);

staticChessmain.tsx2 matches

@injoon5•Updated 10 months ago
11
12 constructor() {}
13 async fetch(req: Request): Promise<Response> {
14 if (new URL(req.url).pathname === "/robots.txt") {
15 return new Response("User-agent: *\nDisallow: /");
232const sc = new StaticChess();
233
234export default analyticsHandlerWrapper(sc.fetch.bind(sc));

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago