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=712&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 8994 results for "fetch"(1281ms)

uploadImagemain.tsx2 matches

@easrng•Updated 12 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",

currencymain.tsx5 matches

@stevekrouse•Updated 12 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3function fetchJSON(url) {
4 return fetch(url).then(res => res.json());
5}
6
7export let currency = async (desired, base = "usd", amount = 1) => {
8 let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`);
9 if (rates && rates[desired.toUpperCase()]) return amount * (rates[desired.toUpperCase()]);
10 else {
11 let { rates } = await fetchJSON("https://api.coingecko.com/api/v3/exchange_rates");
12 return amount * rates[desired.toLowerCase()]?.value / rates[base.toLowerCase()]?.value;
13 }

Candlewood_Lake_Temp_Alertsmain.tsx2 matches

@samk•Updated 12 months ago
1import { blob } from "https://esm.town/v/std/blob?v=12";
2import { email } from "https://esm.town/v/std/email";
3import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
4
5export default async function(interval: Interval) {
44
45export async function getLakeTemp() {
46 const result = await fetchText("https://www.omniafishing.com/w/candlewood-lake-3-fishing-reports/current-conditions");
47 const temperature = result.match(/<strong>([0-9]+)/)[1];
48 return parseInt(temperature);

Daily_Candlewood_Lake_Temp_Alertsmain.tsx2 matches

@stevekrouse•Updated 12 months ago
1import { blob } from "https://esm.town/v/std/blob?v=12";
2import { email } from "https://esm.town/v/std/email";
3import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
4
5export default async function(interval: Interval) {
44
45export async function getLakeTemp() {
46 const result = await fetchText("https://www.omniafishing.com/w/candlewood-lake-3-fishing-reports/current-conditions");
47 const temperature = result.match(/<strong>([0-9]+)/)[1];
48 return parseInt(temperature);

blob_adminmain.tsx2 matches

@samk•Updated 12 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));

tanCranemain.tsx1 match

@frmysantana•Updated 12 months ago
3export default async function tacoBellNutritionScrapper(req) {
4 const sourceUrl = `https://www.nutritionix.com/taco-bell/menu/premium`;
5 const siteText = await fetch(sourceUrl);
6 const $ = cheerio.load(await siteText.text());
7 const items = $("tr.odd, tr.even").map((i, e) => {

spotifyAPImain.tsx2 matches

@HuskyChicken•Updated 12 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let spotifyAPI = ({token, endpoint, ...params}) => fetchJSON(
4 `https://api.spotify.com/v1/${endpoint}?${new URLSearchParams(params)}`,
5 {

rawmain.tsx3 matches

@pomdtr•Updated 12 months ago
5async function createScreenshot(code: string) {
6 const apiUrl = "https://sourcecodeshots.com/api/image";
7 const resp = await fetch(apiUrl, {
8 method: "POST",
9 headers: {
39 }
40 }
41 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`, {
42 headers,
43 });
49 if (url.searchParams.has("v")) {
50 const version = url.searchParams.get("v");
51 const resp = await fetch(
52 `https://api.val.town/v1/vals/${val.id}/versions/${version}`,
53 { headers },

cors_proxymain.tsx2 matches

@adrienj•Updated 12 months ago
52 };
53
54 // Perform the fetch request to the destination URL
55 const response = await fetch(destUrlString, init);
56
57 // Return the response from the destination URL, including CORS headers

esmTownmain.tsx2 matches

@jdan•Updated 12 months ago
4
5function esmTown(url) {
6 return fetch(url, {
7 headers: {
8 "User-Agent":
13
14const app = new Hono();
15export default app.fetch;
16
17app.get("/", async (c) => {

TAC_FetchBasic2 file matches

@A7_OMC•Updated 3 hours ago

hn-fetch1 file match

@matija•Updated 5 hours ago