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=612&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 8300 results for "fetch"(1007ms)

blob_adminmain.tsx2 matches

@janpaul123•Updated 10 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));

valwritermain.tsx6 matches

@janpaul123•Updated 10 months ago
2import { updateValByName } from "https://esm.town/v/nbbaier/updateValByName?v=14";
3import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth?v=62";
4import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
5import { chat } from "https://esm.town/v/stevekrouse/openai";
6import cronstrue from "npm:cronstrue";
19It stores each line of the poem in sqlite.
20It has a textbox that lets anyone input a new line to the poem.`,
21 content: await fetchText("https://esm.town/v/stevekrouse/poembuilder3?v=4"),
22 },
23 {
24 user: "an app that uses chatgpt to convert natural language to cron syntax",
25 content: await fetchText("https://esm.town/v/stevekrouse/cron2"),
26 },
27];
29const app = new Hono();
30
31export default basicAuth(app.fetch);
32app.get("/", async (c) => {
33 const example = examples[Math.floor(Math.random() * examples.length)];
98 Write ONLY Deno TypeScript.
99
100 If you use Hono, use \`export default app.fetch;\` to start the server.
101
102 Only use web standard fetch.
103 // Our library for SQLite
104 import { sqlite } from "https://esm.town/v/std/sqlite";

spotifymain.tsx9 matches

@hunty•Updated 10 months ago
2import { home, scopesRoute } from "https://esm.town/v/hunty/spotify_helpers";
3import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
4import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
5import { querystring } from "https://esm.town/v/stevekrouse/querystring";
6import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
25
26export let spotifyRequestToken = ({ client_id, client_secret, code, redirect_uri }) =>
27 fetchJSON("https://accounts.spotify.com/api/token", {
28 method: "POST",
29 body: querystring({
39
40export let spotifyRefreshToken = async ({ refresh_token, client_id, client_secret }) =>
41 fetch("https://accounts.spotify.com/api/token", {
42 method: "POST",
43 body: new URLSearchParams({
191
192 try {
193 const currentlyPlaying = await fetch("https://api.spotify.com/v1/me/player/currently-playing", {
194 method: "GET",
195 headers: {
207
208 if (!mostRecentTrack) {
209 const recentTracks = await fetch("https://api.spotify.com/v1/me/player/recently-played", {
210 method: "GET",
211 headers: {
220 }
221 catch (e) {
222 return c.json({ error: "Fetch Error" + e }, 500);
223 }
224});
232
233 try {
234 const playStateResponse = await fetch("https://api.spotify.com/v1/me/player?market=US", {
235 method: "GET",
236 headers: {
251 }
252 catch (e) {
253 return c.json({ error: "Fetch Error" + e }, 503);
254 }
255});
256
257export default app.fetch;

dailyPoemForSammain.tsx3 matches

@iamseeley•Updated 10 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3async function getRandomPoem() {
4 const response = await fetch("https://poetrydb.org/random");
5 const [poem] = await response.json();
6 return poem;
16 const message = `Daily Poem:\n\n${title}\nby ${author}\n\n${lines}`;
17
18 const response = await fetch('https://samwho-notify.web.val.run', {
19 method: 'POST',
20 headers: {

urlMetadatamain.tsx1 match

@yawnxyz•Updated 10 months ago
6 return metadata;
7 } catch (err) {
8 console.error('Error fetching metadata:', err);
9 return null;
10 }

acemain.tsx1 match

@saolsen•Updated 10 months ago
99
100export default async function handler(req: Request): Promise<Response> {
101 return await app.fetch(req);
102}

notifymain.tsx2 matches

@samwho•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",

isMyWebsiteDownmain.tsx2 matches

@netizen•Updated 10 months ago
9 let reason: string;
10 try {
11 const res = await fetch(URL, { redirect: "follow" });
12 if (res.status !== 200) {
13 reason = `(status code: ${res.status})`;
15 }
16 } catch (e) {
17 reason = `couldn't fetch: ${e}`;
18 ok = false;
19 }

randomCardImagemain.tsx4 matches

@jamiedubs•Updated 10 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function(req: Request): Promise<Response> {
4 try {
5 const response = await fetch(
6 "https://deckofcardsapi.com/api/deck/new/draw/?count=1",
7 );
14 }
15 } catch (error) {
16 console.log("Error fetching random card image:", error);
17 return Response.json({
18 error: `An error occurred while fetching the random card image. ${error}`,
19 }, { status: 400 });
20 }

streammain.tsx10 matches

@tempguy•Updated 10 months ago
1/** @jsxImportSource npm:hono@3/jsx */
2import { fetch as proxyFetch } from "https://esm.town/v/std/fetch";
3import { Hono } from "npm:hono";
4const Fetch = fetch;
5
6interface ShowBox {
35 const { id } = c.req.param();
36 const post_data = `fid=${id.split(".")[1]}&share_key=${id.split(".")[0]}`;
37 const streamApiRequest = await fetch(`https://www.febbox.com/file/player?${post_data}`, {
38 method: "POST",
39 headers: headers,
69 const _tv = (type === "S") ? `.${season}.1` : "";
70 console.log(_tv);
71 const idApiRequest = await fetch(`https://api.dmdb.network/v1/gmid/${type}.${tmdb}${_tv}`);
72 const idApiJson = await idApiRequest.json();
73 console.log(idApiJson);
78 const mode = type === "M" ? 1 : 2;
79 const sheguId = idApiJson["ids"]["superstream"];
80 const showbox = await fetch(`https://www.showbox.media/index/share_link?id=${sheguId}&type=${mode}`, {
81 headers: headers,
82 });
85 const febboxUrl = `https://www.febbox.com/share/${febboxId}`;
86 console.log(febboxId);
87 const febboxItemRequest = await fetch(`https://www.febbox.com/file/file_share_list?share_key=${febboxId}`, {
88 headers: headers,
89 });
122 if (season === Number(season_number)) {
123 const febboxSeasonId = item.fid;
124 const lastPage = await fetch(
125 `https://www.febbox.com/file/file_share_list?page=1&share_key=${febboxId}&pwd=&parent_id=${febboxSeasonId}`,
126 {
137 }
138 const totalPages = Math.ceil(latestEpisode / 30) + 1;
139 // _temp = await fetch(`https://www.febbox.com/file/file_share_list?page=${totalSections}&share_key=${febboxId}&pwd=&parent_id=${febboxSeasonId}`);
140 // let _tempr = await _temp.json()
141 // const late = _tempr.data.file_list.length;
154 console.log(predictedPages);
155 for (const page of predictedPages) {
156 episodedReq = await fetch(
157 `https://www.febbox.com/file/file_share_list?page=${page}&share_key=${febboxId}&pwd=&parent_id=${febboxSeasonId}`,
158 {
183 }
184}
185export default app.fetch;

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago