twitterRecentMentionsmain.tsx3 matches
1// This val fetches recent tweets about @SnapAR or Lens Studio
2// Updated to use Social Data instead of Twitter API
312return retResponse(data.tweets);
13} catch (error) {
14console.error("Error fetching posts:", error);
15return new Response(JSON.stringify({ error: "Failed to fetch posts", details: error.message }), {
16status: 500,
17headers: { "Content-Type": "application/json" },
socialDataUpdatemain.tsx4 matches
1// This val fetches recent tweets about @SnapAR or Lens Studio, removes duplicates,
2// and displays them as embedded tweets with preview images on a dark background.
3// Updated to use Social Data instead of Twitter API
5import { socialDataSearch } from "https://esm.town/v/stevekrouse/socialDataSearch?v=5";
67// This val fetches recent social media posts about @SnapAR or Lens Studio using socialDataSearch,
8// and displays them as embedded posts with preview images on a dark background.
915return retResponse(data.tweets);
16} catch (error) {
17console.error("Error fetching posts:", error);
18return new Response(JSON.stringify({ error: "Failed to fetch posts", details: error.message }), {
19status: 500,
20headers: { "Content-Type": "application/json" },
youtubeSearchResultsmain.tsx3 matches
14setLoading(true);
15try {
16const response = await fetch(`/search?q=${encodeURIComponent(query)}`);
17if (!response.ok) {
18throw new Error(`HTTP error! status: ${response.status}`);
88try {
89const searchUrl = `https://www.youtube.com/results?search_query=${encodeURIComponent(query)}`;
90const response = await fetch(searchUrl);
91if (!response.ok) {
92throw new Error(`YouTube search failed: ${response.statusText}`);
123} catch (error) {
124console.error("Search error:", error);
125return new Response(JSON.stringify({ error: "An error occurred while fetching search results." }), {
126headers: { "Content-Type": "application/json" },
127status: 500,
weekly_mortgage_ratesmain.tsx4 matches
12const FRED_API_KEY = process.env.FRED_API_KEY;
1314// Function to fetch rate data from FRED API
15async function getRateData(seriesId: string): Promise<RateData> {
16const url =
17`https://api.stlouisfed.org/fred/series/observations?series_id=${seriesId}&api_key=${FRED_API_KEY}&file_type=json&sort_order=desc&limit=2`;
1819const response = await fetch(url);
20const data = await response.json();
2134};
35} else {
36throw new Error(`Failed to fetch data for series ${seriesId}`);
37}
38}
3940// Function to fetch all rate data
41async function getAllRateData(): Promise<RateData[]> {
42const seriesIds = ["MORTGAGE30US", "SOFR30DAYAVG"];
smoothBluePanthermain.tsx1 match
12const updateHtml = async () => {
13try {
14const response = await fetch("/api/modify", {
15method: "POST",
16headers: { "Content-Type": "application/json" },
ThreadmarkLISTFetcher2main.tsx15 matches
11loading = true;
12updateUI();
13console.log(`Fetching threadmarks for URL: ${url}`);
14try {
15result = await fetchThreadmarksFromServer(url, chapterTitles);
16} catch (error) {
17console.log(`Error occurred while fetching threadmarks: ${error.message}`);
18result = { error: error.message };
19}
26root.innerHTML = `
27<div>
28<h1>Threadmark Fetcher and Comparator</h1>
29<form id="threadmarkForm">
30<div>
33id="urlInput"
34value="${url}"
35placeholder="Enter URL to fetch threadmarks"
36required
37/>
46</div>
47<button type="submit" ${loading ? "disabled" : ""}>
48${loading ? "Fetching..." : "Fetch and Compare Threadmarks"}
49</button>
50</form>
139}
140141async function fetchThreadmarksFromServer(url, chapterTitles) {
142const response = await fetch("/api/threadmarks", {
143method: "POST",
144headers: {
171172const requestStartTime = Date.now();
173const response = await fetch(scrapingBeeUrl);
174const requestDuration = Date.now() - requestStartTime;
175206allThreadmarks = allThreadmarks.concat(threadmarks);
207} catch (error) {
208console.error(`[ERROR] Exception during fetching or parsing for category ${category}:`);
209console.error(`[ERROR] Error name: ${error.name}`);
210console.error(`[ERROR] Error message: ${error.message}`);
217const totalDuration = Date.now() - startTime;
218console.log(
219`[END] Finished fetching threadmarks for all categories in ${totalDuration} ms. Total threadmarks found: ${allThreadmarks.length}`,
220);
221323try {
324const { url, chapterTitles } = await request.json();
325// console.log(`[INFO] Received request to fetch threadmarks for URL: ${url}`);
326const threadmarks = await getThreadmarkUrls(url, apiKey);
327console.log(`[INFO] Retrieved ${threadmarks.length} threadmarks`);
342}
343} catch (error) {
344console.error("[ERROR] Error in threadmark fetching or comparison:");
345console.error(`[ERROR] Error name: ${error.name}`);
346console.error(`[ERROR] Error message: ${error.message}`);
348return new Response(
349JSON.stringify({
350error: `Error fetching threadmarks: ${error.message}`,
351stack: error.stack,
352}),
367<meta charset="UTF-8">
368<meta name="viewport" content="width=device-width, initial-scale=1.0">
369<title>Threadmark Fetcher and Comparator</title>
370<style>${CSS}</style>
371</head>
spotifyPlaylistSearchmain.tsx2 matches
10const searchPlaylists = async () => {
11try {
12const response = await fetch(`/search?q=${encodeURIComponent(query)}`);
13if (!response.ok) {
14throw new Error(`HTTP error! status: ${response.status}`);
121const url = `https://itunes.apple.com/search?term=${encodeURIComponent(query)}&entity=playlist&limit=20`;
122123const response = await fetch(url);
124125if (!response.ok) {
effortlessCrimsonDolphinmain.tsx2 matches
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
34const query = "\"val.town\" OR \"val.run\" OR \"val town\" -_ValTown_ -is:retweet -from:valenzuelacity";
9const since = lastRunAt ? Math.floor(lastRunAt.getTime() / 1000) : 0;
10url.searchParams.append("query", query + " since_time:" + since);
11const { tweets } = await fetchJSON(url.toString(), {
12bearer: Deno.env.get("SOCIAL_DATA_API_KEY"),
13});
multiUserChatwithLLMmain.tsx12 matches
1213useEffect(() => {
14fetchMessages();
15getOrCreateUsername();
16const intervalId = setInterval(() => {
17fetchNewMessages();
18checkReset();
19}, 1000); // Poll every second
32let storedUsername = localStorage.getItem("chatUsername");
33if (!storedUsername) {
34const response = await fetch("/username");
35const data = await response.json();
36storedUsername = data.username;
40};
4142const fetchMessages = async () => {
43const response = await fetch("/messages");
44const data = await response.json();
45setMessages(data);
49};
5051const fetchNewMessages = async () => {
52const response = await fetch(`/new-messages?lastId=${lastMessageIdRef.current}`);
53const newMessages = await response.json();
54if (newMessages.length > 0) {
5960const checkReset = async () => {
61const response = await fetch(`/check-reset?token=${resetTokenRef.current}`);
62const data = await response.json();
63if (data.reset) {
74setInput("");
7576const response = await fetch("/send", {
77method: "POST",
78headers: { "Content-Type": "application/json" },
8182if (response.ok) {
83fetchNewMessages(); // Immediately fetch new messages after sending
84}
85};
8687const resetChat = async () => {
88const response = await fetch("/reset", { method: "POST" });
89if (response.ok) {
90setMessages([]);
164await sqlite.execute(`INSERT INTO ${KEY}_messages_${SCHEMA_VERSION} (role, content, username) VALUES (?, ?, ?)`, ["user", message, username]);
165
166// Fetch recent context
167const contextResult = await sqlite.execute(
168`SELECT role, content, username FROM ${KEY}_messages_${SCHEMA_VERSION}
1Migrated from folder: fanficSearcher/ScrapingBeeAttempt/ThreadmarkLISTFetcher2