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//%22https:/f2.phage.directory/capsid/kMu-biwJ/Kurt%20Profile%20Pic%20-%20Transparent%20Background_large.png/%22?q=fetch&page=1&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 18999 results for "fetch"(722ms)

spotymain.ts3 matches

@skirtowner•Updated 1 hour ago
19 const now = Date.now();
20 if (!cached.accessToken || now >= cached.expiresAt) {
21 const tokenResp = await fetch("https://accounts.spotify.com/api/token", {
22 method: "POST",
23 headers: {
49
50 while (nextUrl) {
51 const resp = await fetch(nextUrl, {
52 headers: { Authorization: `Bearer ${accessToken}` },
53 });
54 if (!resp.ok) {
55 const text = await resp.text();
56 return new Response("Failed to fetch playlists: " + text, {
57 status: 500,
58 });

untitled-7644new-file-7315.ts2 matches

@coolmoves•Updated 1 hour ago
1export default async function (interval: Interval) {
2 const f = await fetch("https://sih-2025-demo.onrender.com/");
3 const s = await f.text();
4 console.log(s);
5 const r = await fetch("https://sih-2025-demo.onrender.com/");
6 const p = await r.text();
7 console.log(p);

HTTP-Statusmain.ts1 match

@emarref•Updated 2 hours ago
13 return new Response(`${status}`, { status });
14});
15export default app.fetch;
46
47**Content-Type Support**:
48- `application/json` - Standard fetch requests
49- `text/plain` - sendBeacon requests (automatically parsed as JSON)
50
197// 500 - Server Error
198{
199 error: "Failed to fetch page data",
200 details: "Notion API error message"
201}
19
20### `useGlimpseData.ts`
21Manages glimpse data fetching and state.
22
23**Parameters:**
24- `glimpseId` - ID of the glimpse to fetch
25- `initialData` - Optional initial data to avoid refetching
26
27**Returns:** `UseGlimpseDataReturn`
29- `loading` - Loading state
30- `error` - Error state
31- `refetch` - Function to manually refetch data
32
33**Usage:**
34```typescript
35const { data, loading, error, refetch } = useGlimpseData(glimpseId, initialData);
36```
37
38### `useAgentData.ts`
39Manages agent data fetching with automatic polling.
40
41**Parameters:**
68**Session Tracking:**
69- Uses `sendBeacon` API for reliable session ending during page unload
70- Falls back to synchronous fetch if sendBeacon fails
71- Handles both normal component unmount and browser tab closure
72

eventsCalendarserver.ts3 matches

@roop•Updated 3 hours ago
16import { html, raw } from "npm:hono@4/html";
17import process from "node:process";
18import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
19import { EventParser } from "./lib/event-parser.ts";
20import { EventInserter } from "./lib/event-inserter.ts";
63 step = "convert";
64 await update(stream, { step, state: "started" });
65 const markdown = await fetchText(`https://r.jina.ai/${requestedUrl}`);
66 result.status = "converted";
67 await update(stream, {
245}
246
247export default app.fetch;

TopTenVideosoutput-generator.js1 match

@pmapower•Updated 4 hours ago
345 js += `
346 // Load custom header
347 fetch('${data.headerUrl}')
348 .then(response => response.text())
349 .then(html => {

TopTenVideosindex.html1 match

@pmapower•Updated 5 hours ago
707 `;
708
709 const response = await fetch(headerUrl);
710 if (response.ok) {
711 const headerHtml = await response.text();

TopTenVideosindex.html3 matches

@pmapower•Updated 5 hours ago
202
203 try {
204 const response = await fetch('/api/test-key', {
205 method: 'POST',
206 headers: { 'Content-Type': 'application/json' },
250
251 try {
252 const response = await fetch(`/api/videos?niche=${encodeURIComponent(niche)}`);
253 const data = await response.json();
254
255 if (!response.ok) {
256 this.showError(data.error || 'Failed to fetch videos', data.details);
257 return;
258 }

TopTenVideosapp.js3 matches

@pmapower•Updated 5 hours ago
36
37 try {
38 const response = await fetch('/api/test-key', {
39 method: 'POST',
40 headers: { 'Content-Type': 'application/json' },
84
85 try {
86 const response = await fetch(`/api/videos?niche=${encodeURIComponent(niche)}`);
87 const data = await response.json();
88
89 if (!response.ok) {
90 this.showError(data.error || 'Failed to fetch videos', data.details);
91 return;
92 }

FetchBasic2 file matches

@bengold•Updated 2 weeks ago

fetch1 file match

@raify•Updated 2 weeks ago