rabbitstreammain.tsx2 matches
29getSourcesParams.append("b", browserid);
30console.log(getSourcesParams);
31const result = await fetch(
32`https://rabbitstream.net/ajax/v2/embed-4/getSources?${getSourcesParams.toString()}`,
33{
49});
5051export default app.fetch;
otherBrokenURLhandlermain.tsx11 matches
44}
4546// Link Fetching Helper
47export class LinkFetcher {
48static discoveredUrls = new Set();
49static pageDepths = new Map();
50static processQueue = [];
51static async fetchLinksFromWebsite(websiteUrl) {
52console.log(`\nFetching links from website: ${websiteUrl}`);
53const discoveredPages = new Set([websiteUrl]);
54const pagesToProcess = [websiteUrl];
7273console.log(`Making LSD API request for ${pageUrl}...`);
74const response = await fetch(
75`https://lsd.so/api?query=${encodeURIComponent(query)}`
76);
7778if (!response.ok) {
79console.log(`Failed to fetch links from ${pageUrl}`);
80return [];
81}
110}
111112console.log(`Successfully fetched ${allLinks.length} links from ${discoveredPages.size} pages`);
113return allLinks;
114}
154try {
155console.log(`Attempting HEAD request for: ${url}`);
156const response = await fetch(url, { method: 'HEAD' });
157
158if (!response.ok) {
159console.log(`HEAD request failed, attempting GET request for: ${url}`);
160const getResponse = await fetch(url, { method: 'GET' });
161return { ok: getResponse.ok, status: getResponse.status };
162}
307};
308
309// Fetch all links with progress tracking
310const links = await LinkFetcher.fetchLinksFromWebsite(websiteUrl);
311const totalPages = new Set(links.map(link => new URL(link.link, websiteUrl).origin + new URL(link.link, websiteUrl).pathname)).size;
312
cerebras_codermain.tsx1 match
2324try {
25const response = await fetch("/", {
26method: "POST",
27body: JSON.stringify({ prompt, currentCode: code }),
curiousTurquoiseDormousemain.tsx5 matches
51setTrainingPlan("");
52setYoutubeLinks([]);
53const response = await fetch("/generate-training", {
54method: "POST",
55headers: { "Content-Type": "application/json", "Regenerate-Key": regenerateKey.toString() },
76setSharing(true);
77try {
78const response = await fetch("/share-training", {
79method: "POST",
80headers: { "Content-Type": "application/json" },
718const videoPlaceholders = trainingPlan.match(/\[VIDEO: .+?\]/g) || [];
719720// Fetch and embed YouTube videos
721const youtubeLinks = [];
722for (const placeholder of videoPlaceholders) {
809try {
810const searchUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&q=${encodeURIComponent(sport + ' ' + query)}&key=${apiKey}&type=video&maxResults=1`;
811const response = await fetch(searchUrl);
812const data = await response.json();
813if (data.error) {
819}
820} catch (error) {
821console.error("Error fetching from YouTube API:", error);
822}
823}
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}