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=22&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 13288 results for "fetch"(3222ms)

Lawyersmain.tsx12 matches

@GetUpdated 1 day ago
469 <textarea id="legal-task-query" name="legalTaskQuery" placeholder="E.g., 'Identify all clauses related to termination for cause.' or 'Summarize the key obligations of Party A.'">${escapedQuery}</textarea>
470
471 <label for="doc-url">Document URL (Optional - content will be fetched):</label>
472 <input type="text" id="doc-url" name="documentUrl" value="${escapedUrl}" placeholder="https://example.com/legal-document.html">
473
711            inputSourceDescription = \`URL: \${urlValue}\`;
712            formData.append('documentUrl', urlValue);
713            addStatusMessage(\`Fetching and processing content from URL: \${urlValue}\`, 'progress');
714        }
715        formData.append('inputSourceDescription', inputSourceDescription);
717
718        try {
719            const response = await fetch(window.location.pathname + '?format=json', {
720                method: 'POST',
721                body: formData,
775 // Check if a "Starting analysis..." message exists and remove it or similar progress ones
776 const existingProgress = statusContainer.querySelector('.status-entry.progress');
777 if(existingProgress && (existingProgress.textContent.includes('Starting analysis...') || existingProgress.textContent.includes('Uploading and processing') || existingProgress.textContent.includes('Fetching and processing') || existingProgress.textContent.includes('Processing pasted text'))) {
778 // Don't clear all if server logs were already added
779 } else {
815 const { OpenAI } = await import("https://esm.town/v/std/openai");
816 const { z } = await import("npm:zod"); // For potential future robust input validation on server
817 const { fetch } = await import("https://esm.town/v/std/fetch");
818 const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");
819
939 documentText = input.documentText;
940 } else if (input.documentUrl) {
941 log.push({ agent: ingestionAgent, type: "step", message: `Fetching from URL: ${input.documentUrl}` });
942 try {
943 // Basic fetch, consider adding User-Agent, timeout, error handling, content-type checking
944 const response = await fetch(input.documentUrl, {
945 headers: { "Accept": "text/plain, text/html, application/pdf" },
946 }); // Accept PDF too
949 const contentType = response.headers.get("content-type") || "";
950 if (contentType.includes("application/pdf")) {
951 log.push({ agent: ingestionAgent, type: "info", message: "Fetched PDF from URL. Extracting text..." });
952 const pdfBuffer = await response.arrayBuffer();
953 documentText = await extractPdfTextNative(
962 } else { // Assume text-like
963 const text = await response.text();
964 if (!text || text.trim().length === 0) throw new Error("Fetched content is empty or not text.");
965 log.push({ agent: ingestionAgent, type: "info", message: `Fetched ~${text.length} characters from URL.` });
966 documentText = text;
967 }
968 } catch (error) {
969 const errorMessage = `Failed to fetch or process URL ${input.documentUrl}: ${error.message}`;
970 log.push({ agent: ingestionAgent, type: "error", message: errorMessage });
971 documentText = null;

leglmain.tsx11 matches

@GetUpdated 2 days ago
204 <textarea id="legal-task-query" name="legalTaskQuery" placeholder="E.g., 'Identify all clauses related to termination for cause.' or 'Summarize the key obligations of Party A.'">${escapedQuery}</textarea>
205
206 <label for="doc-url">Document URL (Optional - content will be fetched):</label>
207 <input type="text" id="doc-url" name="documentUrl" value="${escapedUrl}" placeholder="https://example.com/legal-document.html">
208
431 inputSourceDescription = \`URL: \${urlValue}\`;
432 formData.append('documentUrl', urlValue);
433 addStatusMessage(\`Fetching and processing content from URL: \${urlValue}\`, 'progress');
434 }
435 formData.append('inputSourceDescription', inputSourceDescription);
438 try {
439 // The Val itself acts as the API endpoint
440 const response = await fetch(window.location.pathname + '?format=json', {
441 method: 'POST',
442 // FormData sets Content-Type automatically
508 const { OpenAI } = await import("https://esm.town/v/std/openai");
509 const { z } = await import("npm:zod"); // For potential future robust input validation on server
510 const { fetch } = await import("https://esm.town/v/std/fetch");
511 const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");
512
632 documentText = input.documentText;
633 } else if (input.documentUrl) {
634 log.push({ agent: ingestionAgent, type: "step", message: `Fetching from URL: ${input.documentUrl}` });
635 try {
636 // Basic fetch, consider adding User-Agent, timeout, error handling, content-type checking
637 const response = await fetch(input.documentUrl, {
638 headers: { "Accept": "text/plain, text/html, application/pdf" },
639 }); // Accept PDF too
642 const contentType = response.headers.get("content-type") || "";
643 if (contentType.includes("application/pdf")) {
644 log.push({ agent: ingestionAgent, type: "info", message: "Fetched PDF from URL. Extracting text..." });
645 const pdfBuffer = await response.arrayBuffer();
646 documentText = await extractPdfTextNative(
655 } else { // Assume text-like
656 const text = await response.text();
657 if (!text || text.trim().length === 0) throw new Error("Fetched content is empty or not text.");
658 log.push({ agent: ingestionAgent, type: "info", message: `Fetched ~${text.length} characters from URL.` });
659 documentText = text;
660 }
661 } catch (error) {
662 const errorMessage = `Failed to fetch or process URL ${input.documentUrl}: ${error.message}`;
663 log.push({ agent: ingestionAgent, type: "error", message: errorMessage });
664 documentText = null;

blog2025-06-03-newsletter-25.md2 matches

@valdottownUpdated 2 days ago
174- [**pomdtr**](https://www.val.town/u/pomdtr) made [extract-feeds](https://www.val.town/x/pomdtr/extract-feeds) to extract RSS feeds from an HTML page.
175- [**curtcox**](https://www.val.town/u/curtcox) made [wwtdotcom](https://www.val.town/x/curtcox/wwtdotcom), a proxy for wwt.com that rewrites all links to stay within the proxy and injects a help widget on every page.
176- [**ashryanio**](https://www.val.town/u/ashryanio) made [halpk](https://www.val.town/x/ashryanio/halpk), which fetches the RSS feed from Astoria Tech's Subcurrent blog and displays a random blog post each time the page is loaded. He also made [subcurrentShuffle](https://www.val.town/x/ashryanio/subcurrentShuffle) with Townie in 15 minutes at that same meetup!
177- [**Cam Pak**](https://www.val.town/u/cameronpak) made [groq-api](https://www.val.town/x/cameronpak/groq-api), a simple API using the AI SDK and Groq.
178- [**mgmarlow**](https://www.val.town/u/mgmarlow) made [aposd-red-flags](https://www.val.town/x/mgmarlow/aposd-red-flags), a simple flashcard app to help learn about common software design red flags from the book A Philosophy of Software Design by John Ousterhout.
179- [**JJG**](https://www.val.town/u/jjg) made [blockbench-plugin](https://www.val.town/x/jjg/blockbench-plugin), which fetches JavaScript or TypeScript files from GitHub repositories or Gists and serves them with the proper content type headers.
180- [**Steve Krouse**](https://www.val.town/u/stevekrouse) made [luciaMagicLinkStarter](https://www.val.town/x/stevekrouse/luciaMagicLinkStarter) to roll-your-own auth & magic link login using Lucia.
181- [**Max**](https://www.val.town/u/maxm) made [sqlitelogs](https://www.val.town/x/maxm/sqlitelogs), a logging system that stores logs in SQLite with a web interface and search functionality.

Legalhelpmain.tsx15 matches

@GetUpdated 2 days ago
31 maxOutputTokens: 4000, // NEW FEATURE: Control AI output length
32 pdfMaxFileSizeMB: 15, // REFACTOR: Centralized
33 urlFetchTimeout: 10000, // NEW FEATURE: Timeout for URL fetching (milliseconds)
34 disclaimerText:
35 "This AI-generated analysis is for informational purposes only and does not constitute legal advice. Consult with a qualified legal professional for advice on specific legal matters. AI analysis may contain errors or omissions.",
40 uploadingFile: (fileName) => `⬆️ Uploading file: ${fileName}...`,
41 processingPDF: (fileName) => `📄 Processing PDF: ${fileName}...`,
42 fetchingURL: (url) => `🌐 Fetching content from: ${url}...`,
43 processingText: "✍️ Processing pasted text...",
44 aiAnalysisInProgress: (model) => `🧠 Analyzing with ${model}, please wait...`,
272 <select id="ai-model" name="aiModel">${modelOptions}</select>
273
274 <label for="doc-url">Document URL (Optional - content will be fetched):</label>
275 <input type="text" id="doc-url" name="documentUrl" value="${escapedUrl}" placeholder="https://example.com/legal-document.html">
276
552 inputSourceDescription = \`Content from URL: \${urlValue}\`;
553 formData.append('documentUrl', urlValue);
554 addStatusMessage(CONFIG.statusMessages.fetchingURL(urlValue), 'progress', 'Client');
555 }
556 formData.append('inputSourceDescription', inputSourceDescription); // Client-side initial description
557
558 try {
559 const response = await fetch(window.location.pathname + '?format=json', {
560 method: 'POST',
561 body: formData,
622 const { OpenAI } = await import("https://esm.town/v/std/openai");
623 // Zod is imported globally via import statement at the top of the script
624 const { fetch } = await import("https://esm.town/v/std/fetch"); // Using std/fetch
625 const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");
626
800 finalInputSourceDescription = `Pasted Text (Length: ${documentText.length} chars)`;
801 } else if (input.documentUrl) {
802 log.push({ agent: ingestionAgent, type: "step", message: CONFIG.statusMessages.fetchingURL(input.documentUrl) });
803 try {
804 const controller = new AbortController(); // NEW FEATURE: Fetch timeout
805 const timeoutId = setTimeout(() => controller.abort(), CONFIG.urlFetchTimeout);
806
807 const response = await fetch(input.documentUrl, {
808 headers: { "Accept": "text/plain, text/html, application/pdf" },
809 signal: controller.signal,
820 agent: ingestionAgent,
821 type: "info",
822 message: `Fetched PDF from URL '${input.documentUrl}'. Extracting text...`,
823 });
824 const pdfBuffer = await response.arrayBuffer();
834 } else {
835 const text = await response.text();
836 if (!text || text.trim().length === 0) throw new Error("Fetched content is empty or not text-like.");
837 log.push({
838 agent: ingestionAgent,
839 type: "info",
840 message: `Fetched ~${text.length} characters from URL '${input.documentUrl}'.`,
841 });
842 documentText = text;
845 }
846 } catch (error) {
847 const errorMsg = error.name === "AbortError" ? "Fetch timed out." : error.message;
848 const errorMessage = `Failed to fetch or process URL ${input.documentUrl}: ${errorMsg}`;
849 log.push({ agent: ingestionAgent, type: "error", message: errorMessage });
850 documentText = null;

templateTwitterAlertmain.tsx1 match

@JUSTOUpdated 2 days ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

untitled-4435main.tsx13 matches

@CfvvvvvUpdated 2 days ago
604 const triggerTelegramInteraction = async (chatId) => {
605 try {
606 const response = await fetch("/handle-telegram-interaction", {
607 method: "POST",
608 headers: { "Content-Type": "application/json" },
621 };
622
623 const fetchUserBalance = async () => {
624 let userId = null;
625 let isTelegramEnv = false;
674 if (userId) {
675 try {
676 const response = await fetch(`/get-balance?uid=${userId}`);
677 if (!response.ok) {
678 try {
699 }
700 } catch (error) {
701 console.error("Failed to fetch or process balance:", error.toString());
702 setBalance("Error");
703 }
704 } else {
705 console.error("User ID could not be determined for balance fetching.");
706 setBalance("--.--");
707 }
731 window.Telegram.WebApp.ready();
732 }
733 fetchUserBalance();
734 } else if (isTelegramWebAppPresent) {
735 console.log(
736 "Telegram script present, but user data not immediately available or ready() pending. Setting timeout for balance fetch.",
737 );
738 if (window.Telegram.WebApp.ready) {
739 window.Telegram.WebApp.ready();
740 }
741 scriptLoadTimeoutId = setTimeout(fetchUserBalance, 300);
742 } else {
743 console.log("Not in Telegram environment. Proceeding as web user for balance fetch.");
744 fetchUserBalance();
745 }
746 }
882 setShowSpinner(true);
883
884 const response = await fetch("/save-credentials", {
885 method: "POST",
886 headers: { "Content-Type": "application/json" },
1884 const sendActualTelegramAPIMessage = async (botToken, chatId, text, parseMode = "Markdown") => {
1885 try {
1886 const response = await fetch(`https://api.telegram.org/bot${botToken}/sendMessage`, {
1887 method: "POST",
1888 headers: { "Content-Type": "application/json" },
2194 if (confirm('Are you sure you want to unban this user?')) {
2195 try {
2196 const response = await fetch('/unban-telegram-user', {
2197 method: 'POST',
2198 headers: { 'Content-Type': 'application/json' },

Contextualindex.ts1 match

@c15rUpdated 2 days ago
353});
354
355export default app.fetch;

cerebras_coderindex.ts1 match

@zee1205Updated 2 days ago
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
6 const query = ?select=name,website,logo_url,description&plan=eq.premium&order=created_at.desc&limit=${limit};
7 const endpoint = supabaseUrl + query;
8 const response = await fetch(endpoint, {
9 headers: {
10 "Authorization":

aiREADME.md1 match

@rupsUpdated 2 days ago
12
13 try {
14 const response = await fetch(url);
15 const data = await response.json();
16 return data;

GithubPRFetcher

@andybakUpdated 1 day ago

proxiedfetch1 file match

@jaydenUpdated 1 day ago