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/$%7Bsuccess?q=fetch&page=793&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 10113 results for "fetch"(2142ms)

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;

duckdbExamplemain.tsx2 matches

@ychahwan•Updated 10 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let duckdbExample = (async () => {
4 async function createWorker(url: string) {
5 const workerScript = await fetch(url);
6 const workerURL = URL.createObjectURL(await workerScript.blob());
7 return new Worker(workerURL, { type: "module" });

duckdbExampleREADME.md1 match

@ychahwan•Updated 10 months ago
1# DuckDB
2
3[DuckDB](https://duckdb.org/) works on Val Town, with only one small tweak! We're basically using DuckDB in the same way you'd use it with a browser - using the WASM package with its dependencies fetched from [jsdelivr](https://www.jsdelivr.com/).
4
5The only trick is to create the worker ourselves rather than using `duckdb.createWorker`. DuckDB's built-in createWorker method doesn't specify a worker type, which causes `type` to default to `classic`, and Deno (our runtime) doesn't support classic workers.

agentplex-deal-flow-email-fetch1 file match

@anandvc•Updated 3 days ago

proxyFetch2 file matches

@vidar•Updated 5 days ago