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/$%7Burl%7D?q=fetch&page=732&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 8596 results for "fetch"(1342ms)

cliOldREADME.md1 match

@pomdtr•Updated 1 year ago
52```
53
54Cli vals don't have access to val town tokens. Instead of trying to replicate your valtown secrets locally, you can configure your cli vals to call your http endpoints using `fetch`.

changesmain.tsx3 matches

@saolsen•Updated 1 year ago
6import {
7 init,
8 traced_fetch,
9 traced_handler,
10} from "https://esm.town/v/saolsen/tracing";
39 val_req_url = `${val_req_url}?v=${version}`;
40 }
41 const val_resp: Response = await traced_fetch(val_req_url);
42 const val_version = Number(val_resp.url.split("?v=")[1]);
43 const val_body: string = await val_resp.text();
166async function handler(req: Request): Promise<Response> {
167 await track("saolsen.changes", req);
168 return await app.fetch(req);
169}
170

siversRssEmailNotificationmain.tsx2 matches

@chet•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=11";
2import { fetchRSS } from "https://esm.town/v/stevekrouse/fetchRSS";
3import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems?v=6";
4import { parseXML } from "https://esm.town/v/stevekrouse/parseXML";
8 const lastRunAt = interval.lastRunAt;
9
10 const response = await fetch("https://sive.rs/en.atom");
11 const xml = await response.text();
12 const data = await parseXML(xml);

runnermain.tsx2 matches

@buttondown•Updated 1 year ago
2import { email } from "https://esm.town/v/std/email?v=9";
3import { set } from "https://esm.town/v/std/set?v=11";
4import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
5
6export const runner = async () => {
14 ];
15 const promises = ALERT_STRINGS.map(async function(keyword) {
16 let posts = await fetchJSON(
17 `https://search.bsky.social/search/posts?q=${keyword}`,
18 );

testFetchCommentsValmain.tsx4 matches

@willthereader•Updated 1 year ago
1import { ConstructReadTangleUrl } from "https://esm.town/v/willthereader/ConstructReadTangleUrl";
2import { fetchComments } from "https://esm.town/v/willthereader/fetchComments";
3import { logMessage } from "https://esm.town/v/willthereader/logMessage";
4import { testUrlConstructionVal } from "https://esm.town/v/willthereader/testUrlConstructionVal";
5
6export const testFetchCommentsVal = async () => {
7 const urls = [
8 "https://www.readtangle.com/members/api/comments/?post_id=0%3A6",
22 "https://www.readtangle.com/members/api/comments/?post_id=0%3A6",
23 ]; // Await the resolution of the promise from testUrlConstructionVal
24 await fetchComments(urls); // Now urls is an array, so it can be passed to fetchComments
25};
26
27testFetchCommentsVal();

runGistmain.tsx2 matches

@pomdtr•Updated 1 year ago
1import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=42";
3
4export default async function (req: Request) {
27 }
28
29 const gist = await fetchJSON(`https://api.github.com/gists/${id}`);
30 if (gist.owner.login != author) {
31 return new Response("Unauthorized", {

untitled_cyanLampreymain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { timed } from "https://esm.town/v/stevekrouse/timed";
4
5const dateme_html_cache = await (await fetch("https://stevekrouse-dateme.web.val.run/")).text();
6
7await blob.delete("dateme_html_cache");

check_hfsmain.tsx2 matches

@rejetto•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2export default async function(req: Request): Promise<Response> {
3 const p = Object.fromEntries(new URL(req.url).searchParams);
4 if (!p.url) return Response.json("missing url");
5 console.log("checking", p.url);
6 const res = await fetch(p.url);
7 if (!res.ok) return Response.json(res.status);
8 const txt = await res.text();

gptMemoryManagermain.tsx1 match

@xkonti•Updated 1 year ago
458 });
459
460 return app.fetch(req);
461};

youtubeEndpointmain.tsx10 matches

@syncretizm•Updated 1 year ago
2import { YouTube } from 'https://deno.land/x/youtube@v0.3.0/mod.ts';
3
4export async function fetchVideoDetails(req) {
5 const url = new URL(req.url);
6 let yturl = url.searchParams.get("yturl") || "";
29
30 try {
31 let response = await fetch(apiUrl);
32 let data = await response.json();
33 if (!data.items || data.items.length === 0) {
84 const categoryId = item.snippet.categoryId;
85 apiUrl = `https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&id=${categoryId}&key=${apiKey}`;
86 response = await fetch(apiUrl);
87 data = await response.json();
88 const category = data.items && data.items.length > 0 ? data.items[0].snippet.title : 'N/A';
94 break;
95 case 'transcript':
96 async function fetchcaptions(videoId) {
97 const WATCH_URL = `https://www.youtube.com/watch?v=${videoId}`;
98
99 try {
100 const response = await fetch(WATCH_URL);
101 const html = await response.text();
102 const jsonMatch = html.match(/"captions":({.*?}), "videoDetails"/);
110
111 const captionsUrl = captionsJson.captionTracks[0].baseUrl;
112 const captionsResponse = await fetch(captionsUrl);
113 const captionsText = await captionsResponse.text();
114 return captionsText;
115 } catch (error) {
116 console.error('Failed to fetch Youtube captions:', error);
117 throw error;
118 }
119 }
120
121 fetchcaptions(videoId).then(captions => {
122 return new Response(captions);
123 }).catch(error => {
124 console.error('Error fetching captions:', error)
125 });
126
130 return new Response(responseContent);
131 } catch (error) {
132 console.error("Error fetching video details:", error);
133 throw error;
134 }

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago