efficientAmberUnicornmain.tsx4 matches
25const videoPlaceholders = trainingPlan.match(/\[VIDEO: .+?\]/g) || [];
2627// Fetch and embed YouTube videos
28const youtubeLinks = [];
29for (const placeholder of videoPlaceholders) {
53try {
54const searchUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(sport + ' ' + query)}&key=${apiKey}&type=video&maxResults=5`;
55const response = await fetch(searchUrl);
56const data = await response.json();
57if (data.error) {
62const videoId = data.items[0].id.videoId;
63const videoUrl = `https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics&id=${videoId}&key=${apiKey}`;
64const videoResponse = await fetch(videoUrl);
65const videoData = await videoResponse.json();
66if (videoData.items && videoData.items.length > 0) {
78}
79} catch (error) {
80console.error("Error fetching from YouTube API:", error);
81}
82}
6465console.log(">>>> Data", data)
66const response = await fetch(pipeline_url, {
67method: "POST",
68headers: {
296}
297298const response = await fetch('/pageshot', {
299method: 'POST',
300headers: {
550app.post("/pageshot", pageshotHandler);
551552export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
553
renderHTMLWithHonomain.tsx1 match
3940export default async function(req: Request): Promise<Response> {
41return app.fetch(req);
42}
geminiBboxmain.tsx19 matches
62}
6364// Combined function to fetch and handle images
65async function fetchImage(url, options = {}) {
66const { returnType = 'blob' } = options;
67
68console.log("fetchImage url:", url);
69if (!url) return null;
70
71try {
72// Try direct fetch first
73const response = await fetch(url, {
74mode: 'no-cors',
75headers: { 'Accept': 'image/*' }
76});
7778console.log("fetchImage response:", response)
79
80if (response.ok) {
83}
84
85// If direct fetch fails, try our own CORS proxy
86console.log("Direct fetch failed, trying CORS proxy");
87const proxyUrl = "/proxy/" + encodeURIComponent(url);
88console.log("proxyUrl", proxyUrl)
89const proxyResponse = await fetch(proxyUrl);
90
91if (!proxyResponse.ok) {
92throw new Error('Failed to fetch image through CORS proxy');
93}
94
97
98} catch (error) {
99console.error('Error fetching image:', error);
100throw new Error('Failed to fetch image: ' + error.message);
101}
102}
103104// Update the image preview function to use the combined fetchImage
105async function updateImagePreview(url) {
106const imageContainer = document.getElementById('imageContainer');
112
113try {
114const objectUrl = await fetchImage(url, { returnType: 'preview' });
115if (!objectUrl) {
116throw new Error('Failed to load image');
363} else if (urlInput.value) {
364try {
365imageFile = await fetchImage(urlInput.value);
366} catch (error) {
367alert('Error loading image from URL: ' + error.message);
675} else if (urlInput.value) {
676try {
677imageFile = await fetchImage(urlInput.value);
678} catch (error) {
679alert('Error loading image from URL: ' + error.message);
989990try {
991const response = await fetch(url, {
992headers: {
993'Accept': 'image/*',
1002headers: Object.fromEntries(response.headers.entries())
1003});
1004return c.text(`Failed to fetch: ${response.statusText}`, response.status);
1005}
10061019});
10201021export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
10221023
288289async function tokenize() {
290const response = await fetch('/tokenize', {
291method: 'POST',
292headers: {
480}
481482// Export app.fetch for Val Town, otherwise export app — this is only for hono apps
483export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
484
fullWebsiteVersionmain.tsx4 matches
11console.log(`Checking URL: ${url}`);
12try {
13const response = await fetch(url, { method: "HEAD" });
1415if (!response.ok) {
16console.log(`Attempting GET request as fallback for: ${url}`);
17const getResponse = await fetch(url, { method: "GET" });
18return { ok: getResponse.ok, status: getResponse.status };
19}
72`;
7374const lsdResponse = await fetch(
75`https://lsd.so/api?query=${encodeURIComponent(query)}`,
76);
8081if (!lsdResponse.ok) {
82console.error(`Failed to fetch links from ${currentUrl}`);
83continue;
84}
BBslackScoutmain.tsx8 matches
20for (const topic of KEYWORDS) {
21const results = await Promise.allSettled([
22fetchHackerNewsResults(topic),
23fetchTwitterResults(topic),
24fetchRedditResults(topic),
25]);
2649}
5051// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53return hackerNewsSearch({
54query: topic,
58}
5960async function fetchTwitterResults(topic: string): Promise<Website[]> {
61return twitterSearch({
62query: topic,
67}
6869async function fetchRedditResults(topic: string): Promise<Website[]> {
70return redditSearch({ query: topic });
71}
84}
8586const response = await fetch(slackWebhookUrl, {
87method: "POST",
88headers: { "Content-Type": "application/json" },
falProxyRequestmain.tsx1 match
4const headers = new Headers(req.headers);
5headers.set("x-proxy-authorization", `Bearer ${Deno.env.get("valtown")}`);
6return fetch("https://fal-faltownproxy.web.val.run/api/faltown/proxy", {
7method,
8headers,
cerebras_codermain.tsx1 match
2324try {
25const response = await fetch("/", {
26method: "POST",
27body: JSON.stringify({ prompt, currentCode: code }),
reqEvaltownmain.tsx1 match
32const url = new URL("." + pathname, "http://localhost:" + port);
33url.search = search;
34const resp = await fetch(url, {
35method: req.method,
36headers: req.headers,