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/image-url.jpg?q=fetch&page=709&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 9013 results for "fetch"(1300ms)

honoJsxAlpineReactivemain.tsx1 match

@yawnxyz•Updated 11 months ago
30
31
32export default app.fetch;

Appmain.tsx1 match

@xyc•Updated 11 months ago
7import { ObjectInspector } from "https://esm.sh/react-inspector";
8
9async function fetchGgufMetadata(url: string) {
10 const { metadata, tensorInfos } = await gguf(url);
11 return { metadata, tensorInfos };

ageGlifREADME.md1 match

@fab1an•Updated 11 months ago
1a super simple JSON setter/getter using valtown blobs. use GET to fetch it, use POST to set it. expects the inbound data to be JSON for simplicity. use `?key=foobar` to specify different storage locations.
2
3set:

tinygoHttpExamplemain.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/ihml3eg6qee7q2navnnpjqysogqvzdy7.wasm");
3
4export const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));

Title_Extractormain.tsx10 matches

@willthereader•Updated 11 months ago
1import cheerio from "https://esm.sh/cheerio@1.0.0-rc.10";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4// Helper function to retrieve CSRF token if needed
5async function getCsrfToken(url, cookies) {
6 try {
7 console.log("Fetching CSRF Token from URL:", url);
8 console.log("Using Cookies:", cookies);
9 const response = await fetch(url, {
10 headers: {
11 "User-Agent":
24 }
25 const html = await response.text();
26 console.log("Fetched HTML (CSRF Token Request):", html);
27
28 const $ = cheerio.load(html);
31 return csrfToken || "";
32 } catch (error) {
33 console.error("Error fetching CSRF token:", error);
34 return "";
35 }
36}
37
38// Function to fetch HTML content and extract titles
39async function titleExtractor(url, cookies, csrfToken) {
40 try {
41 console.log("Fetching URL:", url);
42 console.log("Using CSRF Token:", csrfToken);
43 const encodedUrl = encodeURI(url);
45 await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 1000) + 500));
46
47 const response = await fetch(encodedUrl, {
48 headers: {
49 "User-Agent":
63 }
64 const html = await response.text();
65 console.log("Fetched HTML:", html);
66
67 const $ = cheerio.load(html);
72 return titles;
73 } catch (error) {
74 console.error("Error fetching or parsing HTML:", error);
75 return [];
76 }

tinygoMandelbrotExamplemain.tsx1 match

@stevekrouse•Updated 11 months ago
1import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
2const resp = await fetch("https://maxm-wasmblobhost.web.val.run/ihml3eg6qee7q2navnnpjqysogqvzdy7.wasm");
3
4export const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));

tinygoMandelbrotExampleREADME.md1 match

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

gptApiFrameworkmain.tsx4 matches

@xkonti•Updated 11 months ago
397 * @example Deno usage:
398 * ```
399 * const { fetch } = gptApi.serve();
400 * export default { fetch };
401 * ```
402 */
403 serve(): typeof Hono.prototype.fetch {
404 return this.app.fetch;
405 }
406

maroonArmadillomain.tsx1 match

@stevekrouse•Updated 11 months ago
4app.get("/", (c) => c.text("Hello world!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;

uniswapV3PositionREADME.md3 matches

@midnightlightning•Updated 11 months ago
6Find the token ID of the Uniswap position you wish to get details about. If you own the liquidity position, you can head to https://app.uniswap.org/pool and click on the v3 position. The ID of that position will be in the URL of the details page.
7
8Append the token ID to the end of this val's URL to fetch data about it (e.g. to get information about token ID `12345`, fetch the url `https://midnightlightning-uniswapv3position.web.val.run/12345`)
9
10# Reference
11This val fetches blockchain data from the following smart contracts:
12
13- **NonfungiblePositionManager(`0xc36442b4a4522e871399cd717abdd847ab11fe88`)** Manages the liquidity position tokens as an ERC721 contract. The `positions` function is used to determine what tokens and tick ranges the individual liquidity position has.
14- **UniswapV3Factory (`0x1F98431c8aD98523631AE4a59f267346ea31F984`)** Contract that manages liquidity pools, and acts as a registry to record where each pairing is deployed to. The `getPool` function is used to find where the smart contract for a specific pairing of ERC20 tokens is deployed to.
15- **ERC20 tokens** Each position has two tokens it's balancing between, and each token has its own instance of an ERC20 contract deployed to the blockchain. The `name` and `symbol` functions are used to determine how to describe each token, and the `decimals` function to determine how to scale the price value for the ratio between them.
16- **UniswapV3Pool** Contract that handles swaps between specific pairs of tokens. The `slot0` function is used to fetch the current price the two tokens are swapping at.

TAC_FetchBasic2 file matches

@A7_OMC•Updated 10 hours ago

hn-fetch1 file match

@matija•Updated 12 hours ago