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/$2?q=fetch&page=1017&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 13558 results for "fetch"(1632ms)

translateTextAPImain.tsx1 match

@sky_porie_fire443•Updated 6 months ago
80 const translationPromises = text_list.map(async (text) => {
81 try {
82 const translationResponse = await fetch(
83 `https://translate.googleapis.com/translate_a/single?client=gtx&sl=${normalizedSourceLang}&tl=${normalizedTargetLang}&dt=t&q=${encodeURIComponent(text)}`,
84 {

findPlatesmain.tsx5 matches

@adnan•Updated 6 months ago
35}
36
37async function fetchRSSFeed(): Promise<any> {
38 try {
39 const response = await fetch("http://numbers.ae/plate/rss");
40 const xmlText = await response.text();
41
59}
60
61// Fetch and parse the RSS feed
62// const feedData = await fetchRSSFeed();
63
64export default async function run() {
65 console.log("running");
66 let results = await fetchRSSFeed();
67 if (results == undefined) {
68 return undefined;

blob_adminmain.tsx23 matches

@andiebuk•Updated 6 months ago
234 const [isDragging, setIsDragging] = useState(false);
235
236 const fetchBlobs = useCallback(async () => {
237 setLoading(true);
238 try {
239 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240 const data = await response.json();
241 setBlobs(data);
242 } catch (error) {
243 console.error("Error fetching blobs:", error);
244 } finally {
245 setLoading(false);
248
249 useEffect(() => {
250 fetchBlobs();
251 }, [fetchBlobs]);
252
253 const handleSearch = (e) => {
264 setBlobContentLoading(true);
265 try {
266 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267 const content = await response.text();
268 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
269 setEditContent(content);
270 } catch (error) {
271 console.error("Error fetching blob content:", error);
272 } finally {
273 setBlobContentLoading(false);
278 const handleSave = async () => {
279 try {
280 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281 method: "PUT",
282 body: editContent,
290 const handleDelete = async (key) => {
291 try {
292 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293 setBlobs(blobs.filter(b => b.key !== key));
294 if (selectedBlob && selectedBlob.key === key) {
307 const key = `${searchPrefix}${file.name}`;
308 formData.append("key", encodeKey(key));
309 await fetch("/api/blob", { method: "POST", body: formData });
310 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311 setBlobs([newBlob, ...blobs]);
315 }
316 }
317 fetchBlobs();
318 };
319
329 try {
330 const fullKey = `${searchPrefix}${key}`;
331 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332 method: "PUT",
333 body: "",
344 const handleDownload = async (key) => {
345 try {
346 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347 const blob = await response.blob();
348 const url = window.URL.createObjectURL(blob);
363 if (newKey && newKey !== oldKey) {
364 try {
365 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366 const content = await response.blob();
367 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368 method: "PUT",
369 body: content,
370 });
371 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373 if (selectedBlob && selectedBlob.key === oldKey) {
383 const newKey = `__public/${key}`;
384 try {
385 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386 const content = await response.blob();
387 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388 method: "PUT",
389 body: content,
390 });
391 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393 if (selectedBlob && selectedBlob.key === key) {
402 const newKey = key.slice(9); // Remove "__public/" prefix
403 try {
404 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405 const content = await response.blob();
406 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407 method: "PUT",
408 body: content,
409 });
410 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412 if (selectedBlob && selectedBlob.key === key) {
825});
826
827export default lastlogin((request: Request) => app.fetch(request));

getIPmain.tsx2 matches

@bansal•Updated 6 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3let result = await fetch("https://api64.ipify.org?format=json");
4let json = await result.json();
5console.log(json.ip);

cerebras_codermain.tsx1 match

@caseyg•Updated 6 months ago
36
37 try {
38 const response = await fetch("/", {
39 method: "POST",
40 body: JSON.stringify({ prompt, currentCode: code }),

kickstart_feedbackmain.tsx5 matches

@bansal•Updated 6 months ago
93 }
94
95 fetch("/airtable-data")
96 .then(response => response.json())
97 .then(data => {
138
139 try {
140 const response = await fetch("/upvote", {
141 method: "POST",
142 headers: {
364 const { recordId, currentUpvotes } = await request.json();
365
366 const updateResponse = await fetch(
367 `https://api.airtable.com/v0/${BASE_ID}/${TABLE_NAME}/${recordId}`,
368 {
396 }
397
398 // Existing data fetch endpoint
399 if (request.url.includes("/airtable-data")) {
400 try {
401 const response = await fetch(
402 `https://api.airtable.com/v0/${BASE_ID}/${TABLE_NAME}`,
403 {

bskymain.tsx1 match

@daisuke•Updated 6 months ago
8 const url = "https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=dai.bsky.social&filter=posts_no_replies";
9
10 const data: Feed = await fetch(url).then((r) => r.json());
11
12 return new Response(

encouragingAmethystTickmain.tsx3 matches

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

amicableAquamarinePanthermain.tsx4 matches

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

CS1200main.tsx4 matches

@timpineda•Updated 6 months ago
1import { email } 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;

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 3 days ago