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/?q=fetch&page=513&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 8446 results for "fetch"(1830ms)

get_clip_download_urlmain.tsx1 match

@sijames•Updated 5 months ago
25 // the weakest possible implementation so it seems like no one really
26 // cares about it.
27 const response = await fetch(`https://gql.twitch.tv/gql`, {
28 method: "POST",
29 headers: {

respectfulMagentaQueleamain.tsx1 match

@azkasources•Updated 5 months ago
24
25 try {
26 const response = await fetch('/research', {
27 method: 'POST',
28 headers: { 'Content-Type': 'application/json' },

emailRandomJokemain.tsx4 matches

@ManuelR_cpu•Updated 5 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 );
11// Parses the response from the joke API.
12
13const randomJoke = await fetchRandomJoke();
14const setup = randomJoke.setup;
15const punchline = randomJoke.punchline;

unbeatableWhiteAnteatermain.tsx4 matches

@mihichalasani•Updated 5 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;

DadJokesmain.tsx4 matches

@aider_n•Updated 5 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;

JokeGeneratormain.tsx4 matches

@hen1227•Updated 5 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;

festiveBlushRoundwormmain.tsx7 matches

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

ThankYouNoteGeneratormain.tsx2 matches

@willthereader•Updated 5 months ago
67 setError("");
68 try {
69 const response = await fetch("/generate", {
70 method: "POST",
71 headers: { "Content-Type": "application/json" },
194 onClick={async () => {
195 try {
196 const response = await fetch(`/update/${noteId}`, {
197 method: "POST",
198 headers: { "Content-Type": "application/json" },

accomplishedBeigeGuineafowlmain.tsx3 matches

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

fullWebsiteCheckermain.tsx19 matches

@willthereader•Updated 5 months ago
52}
53
54// Link Fetching Helper
55export class LinkFetcher {
56 static discoveredUrls = new Set();
57
58 static async fetchLinksFromWebsite(websiteUrl, maxDepth = 5, currentDepth = 0) {
59 if (currentDepth >= maxDepth) {
60 return [];
62
63 currentProgress = {
64 phase: "fetching",
65 processedPages: 0,
66 totalLinks: 0,
75 while (pagesToProcess.length > 0) {
76 currentProgress = {
77 phase: "fetching",
78 processedPages: processedPages.size,
79 totalLinks: allLinks.length,
89 try {
90 const startTime = Date.now();
91 const response = await fetch(pageUrl, {
92 headers: {
93 "User-Agent":
97 const elapsed = Date.now() - startTime;
98 if (elapsed > 3000) {
99 console.log(`Slow page fetch: ${pageUrl} took ${elapsed / 1000} seconds`);
100 }
101
102 if (!response.ok) {
103 console.log(`Failed to fetch page: ${pageUrl}`);
104 return [];
105 }
136
137 processedPages.add(pageUrl);
138 const nestedLinks = await this.fetchLinksFromWebsite(pageUrl, maxDepth, currentDepth + 1);
139 return [...pageLinks, ...nestedLinks];
140 } catch (error) {
150 console.log(`Checkpoint: ${processedPages.size} total pages found, ${allLinks.length} total links`);
151 currentProgress = {
152 phase: "fetching",
153 processedPages: processedPages.size,
154 totalLinks: allLinks.length,
223 for (let attempt = 0; attempt < retries; attempt++) {
224 try {
225 const response = await fetch(url, {
226 method: "GET",
227 headers: {
461 try {
462 console.log(`Starting link check for ${websiteUrl}`);
463 const links = await LinkFetcher.fetchLinksFromWebsite(websiteUrl);
464 console.log(`Fetched ${links.length} links from ${websiteUrl}`);
465 const totalPages = new Set(links.map(link =>
466 new URL(link.link, websiteUrl).origin + new URL(link.link, websiteUrl).pathname
500 intervalId = setInterval(async () => {
501 try {
502 const response = await fetch("/api/progress");
503 if (!response.ok) {
504 throw new Error(`HTTP error! status: ${response.status}`);
508 setProgress(data);
509 } catch (e) {
510 console.error("Error fetching progress:", e);
511 setError(`Error fetching progress: ${e.message}`);
512 }
513 }, 1000);
523 setError(null);
524 try {
525 const response = await fetch("/api/check-links", {
526 method: "POST",
527 headers: {
593 <h2>Progress</h2>
594 <p>Phase: {progress.phase}</p>
595 {progress.phase === "fetching" && (
596 <p>
597 Processed Pages: {progress.processedPages}
733 const maxDepth = 5;
734 currentProgress = {
735 phase: "fetching",
736 processedPages: 0,
737 totalLinks: 0,

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago