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=1026&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 13397 results for "fetch"(1441ms)

laudableFuchsiaMastodonmain.tsx5 matches

@stevekrouse•Updated 7 months ago
17
18 try {
19 const response = await fetch(window.location.href, {
20 method: "POST",
21 headers: { "Content-Type": "application/json" },
102
103 console.log("Sending initial request to Replicate...");
104 const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
105 method: "POST",
106 headers: {
125 while (true) {
126 console.log("Checking result...");
127 const resultResponse = await fetch(prediction.urls.get, {
128 headers: {
129 "Authorization": `Token ${REPLICATE_API_KEY}`,
155 const imageName = `generated-image-${timestamp}.jpg`;
156
157 const imageResponse = await fetch(imageUrl);
158 if (!imageResponse.ok) throw new Error("Failed to download image");
159
174 const imageName = `generated-image-${timestamp}.jpg`;
175
176 const imageResponse = await fetch(imageUrl);
177 if (!imageResponse.ok) throw new Error("Failed to generate image");
178

shirtGenScriptmain.tsx4 matches

@stevekrouse•Updated 7 months ago
24
25 console.log("Sending initial request to Replicate...");
26 const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
27 method: "POST",
28 headers: {
47 while (true) {
48 console.log("Checking result...");
49 const resultResponse = await fetch(prediction.urls.get, {
50 headers: {
51 "Authorization": `Token ${REPLICATE_API_KEY}`,
77 const imageName = `generated-image-${timestamp}.jpg`;
78
79 const imageResponse = await fetch(imageUrl);
80 if (!imageResponse.ok) throw new Error("Failed to download image");
81
96 const imageName = `generated-image-${timestamp}.jpg`;
97
98 const imageResponse = await fetch(imageUrl);
99 if (!imageResponse.ok) throw new Error("Failed to generate image");
100

shirtGenScriptmain.tsx4 matches

@stevekrouse•Updated 7 months ago
24
25 console.log("Sending initial request to Replicate...");
26 const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
27 method: "POST",
28 headers: {
47 while (true) {
48 console.log("Checking result...");
49 const resultResponse = await fetch(prediction.urls.get, {
50 headers: {
51 "Authorization": `Token ${REPLICATE_API_KEY}`,
77 const imageName = `generated-image-${timestamp}.jpg`;
78
79 const imageResponse = await fetch(imageUrl);
80 if (!imageResponse.ok) throw new Error("Failed to download image");
81
96 const imageName = `generated-image-${timestamp}.jpg`;
97
98 const imageResponse = await fetch(imageUrl);
99 if (!imageResponse.ok) throw new Error("Failed to generate image");
100

shirtGenScriptmain.tsx4 matches

@torlanco•Updated 7 months ago
24
25 console.log("Sending initial request to Replicate...");
26 const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
27 method: "POST",
28 headers: {
47 while (true) {
48 console.log("Checking result...");
49 const resultResponse = await fetch(prediction.urls.get, {
50 headers: {
51 "Authorization": `Token ${REPLICATE_API_KEY}`,
77 const imageName = `generated-image-${timestamp}.jpg`;
78
79 const imageResponse = await fetch(imageUrl);
80 if (!imageResponse.ok) throw new Error("Failed to download image");
81
96 const imageName = `generated-image-${timestamp}.jpg`;
97
98 const imageResponse = await fetch(imageUrl);
99 if (!imageResponse.ok) throw new Error("Failed to generate image");
100

sqlitemain.tsx2 matches

@alexandreph•Updated 7 months ago
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {

handleDiscordNewUsermain.tsx2 matches

@buttondown•Updated 7 months ago
23
24 try {
25 const response = await fetch(`https://www.shovel.report/api/domains/${domain}`);
26 if (!response.ok) {
27 throw new Error(`HTTP error! status: ${response.status}`);
33 };
34 } catch (error) {
35 console.error("Error fetching technologies:", error);
36 return { services: [], social_media: {} };
37 }

giftSuggestionAppmain.tsx6 matches

@trollishka•Updated 7 months ago
27 useEffect(() => {
28 if ((age.length > 0 && budget.length > 0) || buttonPressed) {
29 fetchSuggestions();
30 setButtonPressed(false);
31 }
32 }, [age, budget, buttonPressed]);
33
34 const fetchSuggestions = async (isMoreSuggestions: boolean = false) => {
35 setLoading(true);
36 setError(null);
40
41 try {
42 const response = await fetch("/api/shopping-assistant", {
43 method: "POST",
44 headers: { "Content-Type": "application/json" },
60 setShownSuggestions(prevShown => [...prevShown, ...data.suggestions.map(s => s.text)]);
61 } catch (err) {
62 console.error("Error in fetchSuggestions:", err);
63 setError(`An error occurred while fetching suggestions: ${err.message}`);
64 } finally {
65 setLoading(false);
73
74 const handleMoreSuggestions = async () => {
75 await fetchSuggestions(true);
76 };
77

sanguineCyanMastodonREADME.md16 matches

@mikehiggins•Updated 7 months ago
9Fun fact generation about the text (e.g., average word length)
10Summary generation
11The tool is implemented in JavaScript using Hono as a lightweight framework and integrates web APIs for fetching external content and analyzing it in real-time.
12
13Code Structure
16Hono: Used for routing and handling API requests.
17encode (from JS Base64): Utility for encoding data.
18parse (from Node HTML Parser): Parses HTML content, used in fetchUrlContent to clean and extract text.
19Core Modules
20
62Usage: Included in /analyse for quick overviews.
63cleanText(text)
64Purpose: Cleans HTML and unwanted characters from the fetched content.
65Parameters:
66
67text (string): Raw HTML/text. Returns: Cleaned text string.
68Usage: Essential for preprocessing content in fetchUrlContent.
69fetchUrlContent(url)
70Purpose: Fetches HTML content from a URL, removes unwanted elements, and extracts main text.
71Parameters:
72
73url (string): URL to fetch and clean content from. Returns: Cleaned text string or an error message.
74Usage: This function powers the URL input functionality.
75Core Functionalities
76Text Analysis Form (HTML)
77The form on the main page allows users to submit either raw text or a URL. The client-side JavaScript processes the form submission and, if needed, triggers a URL fetch to obtain content.
78
79Backend Processing (Routes)
81GET /: Serves the main HTML page.
82POST /analyse: Analyzes submitted text and returns word count, sentiment, summary, TF-IDF, and word frequency results.
83POST /fetch-url: Retrieves and cleans content from a URL, then prepares it for analysis.
84Dark Mode and Interactivity
85
90Testing
91
92Integration Tests: Ensure calculateTFIDF, calculateWordFrequency, and fetchUrlContent produce consistent outputs.
93Client-Side Testing: Regularly test URL fetching functionality to ensure robustness, particularly with dynamic sites.
94Error Handling
95
96Maintain try/catch blocks in asynchronous functions like fetchUrlContent to capture network issues.
97Update error messages to be user-friendly and provide feedback if inputs are invalid or exceed size limits.
98Data Sanitization
99
100Verify that cleanText removes sensitive information from fetched URLs to prevent accidental disclosure.
101Rate Limits and API Usage
102
119The Radical Text Analyser code primarily uses the following APIs:
1201. Hono Framework API
121 * Purpose: Used to set up routing and serve responses for different endpoints (GET /, POST /analyse, and POST /fetch-url).
122 * Usage: The Hono framework handles HTTP requests and responses, forming the backbone of the server-side API.
1232. External Content Fetching API (via fetch)
124 * Purpose: Retrieves HTML content from external URLs when users input a URL for analysis.
125 * Usage: The fetchUrlContent function uses fetch to make a GET request to the user-provided URL, which allows the application to process content from web pages.
126 * Error Handling: Includes logic to check response status and handle various network errors.
1273. Google Fonts API

scraper_templatemain.tsx1 match

@rickyfarm•Updated 7 months ago
9 const variable: string = await blob.getJSON(blobKey) ?? "";
10
11 const response = await fetch(scrapeURL);
12 const body = await response.text();
13 const $ = cheerio.load(body);

gptmemoryREADME.md1 match

@toowired•Updated 7 months ago
71# Long-term memory
72
73At some point the user might ask you to do something with "memory". Things like "remember", "save to memory", "forget", "update memory", etc. Please use corresponding actions to achieve those tasks. User might also ask you to perform some task with the context of your "memory" - in that case fetch all memories before proceeding with the task. The memories should be formed in a clear and purely informative language, void of unnecessary adjectives or decorative language forms. An exception to that rule might be a case when the language itself is the integral part of information (snippet of writing to remember for later, examples of some specific language forms, quotes, etc.).
74
75Structure of a memory:

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 2 days ago