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/$%7Bart_info.art.src%7D?q=fetch&page=1211&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 13390 results for "fetch"(1427ms)

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 }

checkTensorArtWebStatusmain.tsx3 matches

@lbb00•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
4export async function checkTensorArtWebStatus() {
5 async function sendLarkMessage(message) {
6 return fetch(process.env.larkTensorRobotUrl, {
7 method: "POST",
8 headers: {
29 const responses = await Promise.all(
30 urls.map((url) => {
31 return fetch(url);
32 }),
33 );

untitled_ivoryFishmain.tsx4 matches

@bryanb9•Updated 1 year ago
1import { hamptonzachary29@gmail.com} from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

isMyWebsiteDownmain.tsx3 matches

@ktm•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export const isMyWebsiteDown = async () => {
11 try {
12 const start = Date.now();
13 const res = await fetch(URL);
14 const millisecondsSpent = Date.now() - start;
15 const jsonData = await res.json();
25 }
26 catch (e) {
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }

clerk_hono_pocmain.tsx1 match

@saolsen•Updated 1 year ago
111 }
112});
113export default app.fetch;

untitled_apricotParrotfishmain.tsx1 match

@steveVT•Updated 1 year ago
11app.get("/edit/:blob", async (c) => c.html(`TODO: Edit ${c.req.param("blob")}`));
12app.get("/delete/:blob", async (c) => c.html(`TODO: Delete ${c.req.param("blob")}`));
13export default basicAuth(app.fetch);

untitled_indigoNightingalemain.tsx1 match

@stevekrouse•Updated 1 year ago
11app.get("/edit/:blob", async (c) => c.html(`TODO: Edit ${c.req.param("blob")}`));
12app.get("/delete/:blob", async (c) => c.html(`TODO: Delete ${c.req.param("blob")}`));
13export default basicAuth(app.fetch);

HTHTMXmain.tsx1 match

@wilhelm•Updated 1 year ago
70});
71
72export default app.fetch;

basicAuthmain.tsx4 matches

@stevekrouse•Updated 1 year ago
18};
19
20async function fetchUser(token: string): Promise<User> {
21 const resp = await fetch("https://api.val.town/v1/me", {
22 headers: {
23 Authorization: `Bearer ${token}`,
26
27 if (resp.status !== 200) {
28 throw new Error("Could not fetch user");
29 }
30
34async function isTokenValid(token) {
35 try {
36 const [visitor, owner] = await Promise.all([fetchUser(token), fetchUser(Deno.env.get("valtown"))]);
37 return visitor.id == owner.id;
38 } catch (err) {

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 2 days ago