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/image-url.jpg%20%22Image%20title%22?q=fetch&page=690&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 9289 results for "fetch"(1279ms)

redMonkeymain.tsx6 matches

@tempguy•Updated 9 months ago
1import { fetch as proxiedFetch } from "https://esm.town/v/std/fetch";
2import { customAlphabet } from "npm:nanoid";
3const nanoid = customAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 10);
8 const id = url.split("/e/")[1];
9
10 const doodDataReq = await fetch(
11 `https://cool-proxy.koyeb.app/hdiuhmalkmc9d0ck7UCFVGBJHN?destination=`
12 + encodeURIComponent(`${url}`),
19 const path = doodData.match(/\$\.get\('\/pass_md5([^']+)/)?.[1];
20 const thumbnailTrack = doodData.match(/thumbnails:\s\{\s*vtt:\s'([^']*)'/);
21 const doodPageReq = await fetch(
22 `https://cool-proxy.koyeb.app/hdiuhmalkmc9d0ck7UCFVGBJHN?destination=`
23 + encodeURIComponent(`${baseUrl}/pass_md5${path}`),
70}
71export async function streamwish(ctx) {
72 const _embed = await fetch(ctx.url);
73 const embed = await _embed.text();
74 console.log(embed);
134 // if (Number(_) > 100000) throw new Error("limit reached");
135 // await blob.set("streamtapeLimit", `${Number(_) + 1}`);
136 const _embed = await proxiedFetch(
137 `https://proxy-worker.thunderspeed.workers.dev/proxy?destination=${encodeURIComponent(ctx.url)}`,
138 );
169
170export async function streamium(ctx) {
171 const _embed = await fetch(ctx.url);
172 // https://pump.watchfree.ax/start-play?imdbid=tt11389872&name=apple&season=&episode=
173 const embed = await _embed.text();

sqlite_adminmain.tsx1 match

@stevekrouse•Updated 9 months ago
10app.get("/", async (c) => c.html(await sqlite_admin_tables()));
11app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
12export default basicAuth(app.fetch, { verifyUser: (_, password) => verifyToken(password) });

retiredRedMarlinmain.tsx14 matches

@tempguy•Updated 9 months ago
1import { base } from "https://esm.town/v/tempguy/southcloud";
2
3async function fetchStreamLink() {
4 try {
5 const headers = {
8 "Accept-Language": "en-US,en;q=0.5",
9 "x-site": "anicrush",
10 "Sec-Fetch-Dest": "empty",
11 "Sec-Fetch-Mode": "cors",
12 "Sec-Fetch-Site": "same-site",
13 };
14
15 // Fetch search results
16 const search = await fetch("https://api.anicrush.to/shared/v2/movie/list?keyword=One Piece&limit=10&page=1", {
17 headers,
18 });
21 const id = searchResult.result.movies[0].id;
22
23 // Fetch server data
24 const serverData = await fetch(`https://api.anicrush.to/shared/v2/episode/servers?_movieId=${id}&ep=1`, {
25 headers,
26 });
28 const serverId = serverDataResult.result.sub[0].server;
29
30 // Fetch server link
31 const serverLink = await fetch(
32 `https://api.anicrush.to/shared/v2/episode/sources?_movieId=${id}&ep=1&sv=${serverId}&sc=sub`,
33 { headers },
36 const sid = new URL(serverLinkResult.result.link).pathname.split("/")[3];
37
38 // Fetch stream link
39 const streamLink = await fetch(`https://southcloud.tv/e/ajax/p-1/getSources?id=${sid}`);
40 const streamLinkResult = await streamLink.json();
41
43 console.log(base(streamLinkResult.sources)[0].file);
44 } catch (error) {
45 console.error("Error fetching stream link:", error);
46 }
47}
48
49// Call the function
50fetchStreamLink();

southcloudmain.tsx1 match

@tempguy•Updated 9 months ago
1import CryptoJS from "npm:crypto-js";
2const regex = /case (0[xX][\da-fA-F]+):([a-zA-Z\d]+)=(.),([a-zA-Z\d]+)=(.)/gm;
3const req = await fetch("https://southcloud.tv/js/player/a/sc/prod/p1-debug.min.js");
4const str = await req.text();
5let m;

whenfilmedmain.tsx4 matches

@tmcw•Updated 9 months ago
1// This val creates a movie guessing game using the TMDB API.
2// We'll fetch random movies from different years, present them to the user, and check their guesses.
3// Tradeoffs: We're using a free API with authentication for better data variety.
4
13}
14
15async function fetchRandomMovies() {
16 const currentYear = new Date().getFullYear()
17 const movies = []
23 }
24 chosen.add(year)
25 const response = await fetch(
26 `${TMDB_API_BASE}/discover/movie?language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page=1&primary_release_year=${year}`,
27 { headers },
213
214 if (req.method === "GET") {
215 const movies = await fetchRandomMovies()
216 const uuid = crypto.randomUUID()
217 const moviesKey = `${author}.${name}.movies.${uuid}`

test_migratedREADME.md1 match

@jxnblk•Updated 9 months ago
163. Import `describe` and `it` utilities
174. Write tests
185. Add the badge to your readme, with the `url` parameter pointing to the test suite val's endpoint. Tests run whenever the test suite val or the badge is fetched
19
20```tsx

caniuse_notifiermain.tsx3 matches

@gunnnnii•Updated 9 months ago
32
33 const url = "https://raw.githubusercontent.com/Fyrd/caniuse/main/fulldata-json/data-1.0.json";
34 const data = await fetch(url).then((res) => res.json());
35 const updatedAt = data.updated;
36
37 if (previousDataUpdatedAt >= updatedAt) return;
38
39 const fetchedFeatures = Object.keys(data.data);
40
41 const features = [];
42 for (const feature of fetchedFeatures) {
43 const previousFeature = previousData?.[feature];
44 const previousUsage = previousFeature?.usage_perc_y ?? 0;

blurbsmain.tsx4 matches

@yawnxyz•Updated 9 months ago
78const getContent = async (url: string) => {
79 try {
80 const response = await fetch(`https://r.jina.ai/${url}`);
81 if (!response.ok) {
82 throw new Error(`HTTP error! Status: ${response.status}`);
85 return data;
86 } catch (error) {
87 console.error('Error fetching the URL:', error);
88 return 'Error fetching the content.';
89 }
90};
130});
131
132export default app.fetch;

sqliteAdminmain.tsx4 matches

@kamalnrf•Updated 9 months ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

MinnehahaFlowLevelmain.tsx2 matches

@judson•Updated 9 months ago
65
66 try {
67 const response = await fetch(url);
68 if (!response.ok) {
69 throw new Error(`HTTP error! status: ${response.status}`);
72 return data; // Store the JSON data in a variable
73 } catch (error) {
74 console.error("Error fetching data:", error);
75 }
76}

proxyFetch2 file matches

@vidar•Updated 2 days ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 2 days ago