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/$%7Bsuccess?q=fetch&page=663&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 8976 results for "fetch"(1774ms)

aquaAntmain.tsx18 matches

@tempguy•Updated 9 months ago
18 "Accept": "application/json, text/javascript, */*; q=0.01",
19 "Accept-Language": "en-US,en;q=0.5",
20 "Sec-Fetch-Dest": "empty",
21 "Sec-Fetch-Mode": "no-cors",
22 "Sec-Fetch-Site": "same-origin",
23 "X-Requested-With": "XMLHttpRequest",
24 "Priority": "u=4",
28 }
29
30 async fetchPage() {
31 try {
32 const response = await fetch(this.url, { headers: this.headers });
33
34 if (!response.ok) throw new Error(`Failed to fetch page: ${response.statusText}`);
35
36 const $ = cheerio.load(await response.text());
66 if (server.class === "doodstream") {
67 const id = server.video.split("/")[4];
68 const data = await (await fetch(`https://tempguy-scarletsole.web.val.run/dood/${id}`)).json();
69 this.results.sourceC = data.stream[0].qualities.unknown.url;
70 }
79async function extract(url) {
80 try {
81 const response = await fetch(url, {
82 headers: {
83 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0",
84 "Accept": "application/json, text/javascript, */*; q=0.01",
85 "Accept-Language": "en-US,en;q=0.5",
86 "Sec-Fetch-Dest": "empty",
87 "Sec-Fetch-Mode": "no-cors",
88 "Sec-Fetch-Site": "same-origin",
89 "X-Requested-With": "XMLHttpRequest",
90 "Priority": "u=4",
94 });
95
96 if (!response.ok) throw new Error(`Failed to fetch data: ${response.statusText}`);
97
98 const text = await response.text();
126 }).toString() + _0x249a7e.substr(_0x249a7e.indexOf("&")) + "&alias=" + _0x4d306e;
127
128 const apiResponse = await fetch(api, {
129 headers: {
130 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0",
131 "Accept": "application/json, text/javascript, */*; q=0.01",
132 "Accept-Language": "en-US,en;q=0.5",
133 "Sec-Fetch-Dest": "empty",
134 "Sec-Fetch-Mode": "no-cors",
135 "Sec-Fetch-Site": "same-origin",
136 "X-Requested-With": "XMLHttpRequest",
137 "Priority": "u=4",
141 });
142
143 if (!apiResponse.ok) throw new Error(`Failed to fetch API: ${apiResponse.statusText}`);
144
145 const apiData = await apiResponse.json();
159(async () => {
160 const scraper = new AnimeScraper("https://anitaku.pe/one-piece-dub-episode-1085");
161 await scraper.fetchPage();
162 await scraper.processServers();
163})();

ReactStream_migratedREADME.md2 matches

@jxnblk•Updated 9 months ago
73```
74
75### Fetch data on the server to set initial props
76
77
79// example middleware
80async function getInitialProps (req: Request, res: Response, next) {
81 // fetch data or do async work to pass as props to the component
82 req.data = {
83 hello: "props",

processTrackBlobsJobREADME.md1 match

@dthyresson•Updated 9 months ago
1# processTracksBlobsJob
2
3Periodically fetch all Spotify tracks from Blob storage and update the `tracks` database with a subset of display information.
4
5Keys take the format: `spotify_track_id:4tVhBXOhSlqYCL2IjyoUNu`.

copperScorpionmain.tsx3 matches

@tempguy•Updated 9 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2export default async function(request: Request) {
3 const url = new URL(request.url);
4 const h = url.searchParams.get("tdestination");
5 if (h) {
6 const resp = await fetch(decodeURIComponent(url.searchParams.get("tdestination")), {
7 method: request.method,
8 body: request.body,
13 }
14 else {
15 const resp = await fetch(decodeURIComponent(url.searchParams.get("destination")), {
16 method: request.method,
17 body: request.body,

getSpotifyTrackUrlREADME.md2 matches

@dthyresson•Updated 9 months ago
3Get a Spotify Track Url using the Spotify Web API given an artist and a song title.
4
5Track info is cached by the query and also the spotify track id, so your popular queries won't have to fetch from Spotify over and over.
6
7## Examples
25`SPOTIFY_CLIENT_SECRET`
26
27Your access token is cached by `getSpotifyAccessToken` to avoid fetching over and over.
28
29

silverSwallowmain.tsx1 match

@tempguy•Updated 9 months ago
1import { blob } from "https://esm.town/v/std/blob?v=12";
2export default async function(interval: Interval) {
3 await fetch("https://tempguy-scarletsole.web.val.run/refresh");
4 const date = new Date();
5 await blob.setJSON("turnstileCron", { ptime: date.getTime(), ntime: interval.delay + interval.lastRunAt.getTime() });

whatsThatInHotDogsmain.tsx1 match

@dthyresson•Updated 9 months ago
117});
118
119export default app.fetch;

get_gemini_modelsmain.tsx2 matches

@kora•Updated 9 months ago
11 const API_KEY = process.env.GEMINI_API_KEY;
12
13 const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models?key=${API_KEY}`);
14
15 const data = await response.json();
22 return models;
23 } catch (error) {
24 console.error("Error fetching Gemini models:", error);
25 return [];
26 }

redAnglerfishREADME.md2 matches

@kora•Updated 9 months ago
1# Fetch
2
3Learn how to use proxied fetch

redAnglerfishmain.tsx2 matches

@kora•Updated 9 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);

fetchPaginatedData2 file matches

@nbbaier•Updated 3 weeks ago

FetchBasic1 file match

@fredmoon•Updated 3 weeks ago