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=10&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 8302 results for "fetch"(779ms)

fetchText2 file matches

@mgruel•Updated 1 year ago

fetchPelotonData1 file match

@andreterron•Updated 1 year ago

fetchWithJSON1 file match

@yuler•Updated 1 year ago

fetchDOEMenu2 file matches

@tal•Updated 1 year ago

discordFetch2 file matches

@stevekrouse•Updated 1 year ago

fetchHeaders22 file matches

@stevekrouse•Updated 1 year ago

fetchHeaders21 file match

@mrahnis•Updated 1 year ago

fetchHtmlDom2 file matches

@aeaton•Updated 1 year ago

fetchReadwiseList1 file match

@ofalvai•Updated 1 year ago

fetchTable2 file matches

@stevekrouse•Updated 1 year ago

EEPMOnitoringweeklyReport.tsx16 matches

@solomonferede•Updated 57 mins ago
29 const itemsPerPage = 5; // Items per page for detailed reports
30
31 // Function to fetch the detailed report
32 const fetchDetailedReport = async () => {
33 setDetailedReport(null); // Clear previous data
34 setWeeklySummary(null); // Clear other report data
35 try {
36 const response = await fetch("/generate-report"); // Assuming this endpoint provides detailed data
37 const data = await response.json();
38 setDetailedReport(data);
39 } catch (error) {
40 console.error("Failed to fetch detailed report:", error);
41 alert("Failed to fetch detailed report.");
42 }
43 };
44
45 // Function to fetch the weekly summary report
46 const fetchWeeklySummary = async () => {
47 setWeeklySummary(null); // Clear previous data
48 setDetailedReport(null); // Clear other report data
49 try {
50 // This fetches the summary data for the last 7 days for all users
51 // Assumes the /generate-weekly-summary endpoint exists on the server
52 const response = await fetch("/generate-weekly-summary");
53 const data = await response.json(); // Assuming data is an array like [{ author: 'User A', submittedArticles: 10, monitoredMedia: 5 }, ...]
54 setWeeklySummary(data);
55 } catch (error) {
56 console.error("Failed to fetch weekly summary:", error);
57 alert("Failed to fetch weekly summary.");
58 }
59 };
60
61 // Effect to fetch data when the view changes or component mounts
62 useEffect(() => {
63 if (currentView === "detailed") {
64 fetchDetailedReport();
65 } else if (currentView === "summary") {
66 fetchWeeklySummary();
67 }
68 }, [currentView]); // Dependency array ensures this runs when currentView changes
346 </>
347 )
348 : <p>Fetching detailed report...</p>} {/* Loading indicator */}
349 </>
350 )}
399 </>
400 )
401 : <p>Fetching weekly summary...</p>} {/* Loading indicator */}
402 </>
403 )}

glastonewsindex.ts17 matches

@bensomething•Updated 58 mins ago
2import { BskyAgent } from "npm:@atproto/api";
3import * as cheerio from "npm:cheerio";
4import fetch from "npm:node-fetch";
5
6const agent = new BskyAgent({
13]);
14
15async function fetchWithRetry(url, options = {}, retries = 3, delay = 1000) {
16 for (let i = 0; i < retries; i++) {
17 try {
19 const timeoutId = setTimeout(() => controller.abort(), 15000); // 15 seconds timeout
20
21 const response = await fetch(url, {
22 ...options,
23 signal: controller.signal,
33
34 if (!response.ok) {
35 throw new Error(`Failed to fetch: ${response.statusText}`);
36 }
37 return response;
38 } catch (error) {
39 if (i < retries - 1) {
40 console.warn(`Fetch attempt ${i + 1} failed. Retrying...`);
41 await new Promise(resolve => setTimeout(resolve, delay));
42 } else {
47}
48
49async function fetchNews() {
50 const url = "https://glastonburyfestivals.co.uk/news/";
51 try {
52 const response = await fetchWithRetry(url);
53 const html = await response.text();
54 const $ = cheerio.load(html);
65 return news;
66 } catch (error) {
67 console.error("Error fetching news:", error);
68 throw error;
69 }
70}
71
72async function fetchEmbedData(url) {
73 try {
74 const response = await fetchWithRetry(url);
75 const html = await response.text();
76 const $ = cheerio.load(html);
84 const imageUrl = $("meta[property='og:image']").attr("content");
85 if (imageUrl) {
86 console.log("Fetching image for URL:", imageUrl);
87 const imgResponse = await fetchWithRetry(imageUrl);
88 const contentType = imgResponse.headers.get("content-type");
89 console.log("Image content type:", contentType);
120 };
121 } catch (error) {
122 console.error("Error fetching embed data:", error);
123 return null;
124 }
130 console.log("Logged in successfully.");
131
132 const newsItems = await fetchNews();
133 console.log(`Fetched ${newsItems.length} news items.`);
134
135 const latestNews = newsItems.find(news => !postedNewsTitles.has(news.title));
138 console.log(`Attempting to post new news: ${latestNews.title}`);
139
140 const embedData = await fetchEmbedData(latestNews.link);
141 if (!embedData) {
142 console.error("Failed to fetch embed data. Skipping post.");
143 return;
144 }