evaltownWorkermain.tsx3 matches
26setError("");
27try {
28const res = await fetch(`${window.location.href}api?city=${encodeURIComponent(city)}`);
29const data = await res.json();
30if (data.error) {
159const url = new URL(req.url);
160161if (req.method === "GET" && url.pathname === "/api") {
162const city = url.searchParams.get("city");
163if (!city) {
167try {
168const weatherUrl =
169`https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t_weather=true&daily=temperature_2m_max,weathercode&timezone=auto&forecast_days=5`;
170const weatherRes = await fetch(weatherUrl);
171const weatherData = await weatherRes.json();
rabbitstreammain.tsx1 match
16const { provider, id } = c.req.param();
17if (!["rabbit", "mega"].includes(provider)) {
18return c.json({ error: "Invalid API request" }, 500);
19}
20// const cache = await blob.getJSON(id);
graphqlAPIEndpointREADME.md1 match
1Migrated from folder: GraphQL/graphqlAPIEndpoint
falDemoAppmain.tsx2 matches
15try {
16const fal = createFalClient({
17proxyUrl: "/api/fal/proxy",
18});
19139}
140141if (url.pathname === "/api/fal/proxy") {
142return falProxyRequest(req);
143}
otherBrokenURLhandlermain.tsx2 matches
71`;
7273console.log(`Making LSD API request for ${pageUrl}...`);
74const response = await fetch(
75`https://lsd.so/api?query=${encodeURIComponent(query)}`
76);
77
falDemoAppmain.tsx2 matches
15try {
16const fal = createFalClient({
17proxyUrl: "/api/fal/proxy",
18});
19139}
140141if (url.pathname === "/api/fal/proxy") {
142return falProxyRequest(req);
143}
curiousTurquoiseDormousemain.tsx11 matches
332333const css = `
334@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');
335336:root {
664async function server(request: Request): Promise<Response> {
665if (request.method === "POST" && new URL(request.url).pathname === "/generate-training") {
666const YOUTUBE_API_KEY = Deno.env.get("YOUTUBE_API_KEY2");
667const useApiKey = YOUTUBE_API_KEY !== undefined && YOUTUBE_API_KEY !== "";
668if (!YOUTUBE_API_KEY) {
669console.warn("YouTube API key (YOUTUBE_API_KEY2) is not set. Falling back to search URL method.");
670}
671722for (const placeholder of videoPlaceholders) {
723const searchQuery = placeholder.replace('[VIDEO: ', '').replace(']', '');
724const videoId = await getYouTubeVideoId(searchQuery, sport, YOUTUBE_API_KEY);
725if (videoId) {
726const embedHtml = `
805}
806807async function getYouTubeVideoId(query, sport, apiKey, useApiKey = true) {
808if (useApiKey) {
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) {
814console.warn("YouTube API error:", data.error.message);
815return getFallbackYouTubeLink(query, sport);
816}
819}
820} catch (error) {
821console.error("Error fetching from YouTube API:", error);
822}
823}
efficientAmberUnicornmain.tsx11 matches
8async function server(request: Request): Promise<Response> {
9if (request.method === "POST" && new URL(request.url).pathname === "/generate-training") {
10const YOUTUBE_API_KEY = Deno.env.get("YOUTUBE_API_KEY2");
11const useApiKey = YOUTUBE_API_KEY !== undefined && YOUTUBE_API_KEY !== "";
12if (!YOUTUBE_API_KEY) {
13console.warn("YouTube API key (YOUTUBE_API_KEY2) is not set. Falling back to search URL method.");
14}
1529for (const placeholder of videoPlaceholders) {
30const searchQuery = placeholder.replace('[VIDEO: ', '').replace(']', '');
31const videoData = await getYouTubeVideoData(searchQuery, sport, YOUTUBE_API_KEY);
32if (videoData && isVideoRelevant(videoData, sport, searchQuery)) {
33const embedHtml = `
49}
5051async function getYouTubeVideoData(query, sport, apiKey, useApiKey = true) {
52if (useApiKey) {
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) {
58console.warn("YouTube API error:", data.error.message);
59return null;
60}
61if (data.items && data.items.length > 0) {
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();
78}
79} catch (error) {
80console.error("Error fetching from YouTube API:", error);
81}
82}
falDemoAppmain.tsx2 matches
15try {
16const fal = createFalClient({
17proxyUrl: "/api/fal/proxy",
18});
19139}
140141if (url.pathname === "/api/fal/proxy") {
142return falProxyRequest(req);
143}
geminiBboxmain.tsx15 matches
6*
7* Key features:
8* - Integrates with Google's Generative AI API
9* - Processes user-uploaded images for object detection
10* - Visualizes detected objects with bounding boxes
11* - Allows customization of detection parameters (grid, contrast)
12* - Stores API key securely in browser's local storage
13*
14* The app is built using Hono.js and can be deployed on Val Town or run locally with Deno.
29<p>This application visualizes object detection results by drawing bounding boxes on images using the <a href="https://ai.google.dev/">Google's Gemini 1.5 Pro AI model</a>.</p>
3031<p>API keys are only stored in your browser's local storage.</p>
32<p>Images are only sent to Google's Gemini API servers for processing.</p>
3334<p>Try the following images (click the links to add them):</p>
174window.handleImageUrlClick = handleImageUrlClick;
175176// Retrieves the API key from local storage or prompts the user to enter it
177function getApiKey() {
178let apiKey = localStorage.getItem("GEMINI_API_KEY");
179if (!apiKey) {
180apiKey = prompt("Please enter your Gemini API key:");
181if (apiKey) {
182localStorage.setItem("GEMINI_API_KEY", apiKey);
183}
184}
185return apiKey;
186}
187188// Initializes and returns a Google Generative AI model instance
189async function getGenerativeModel(params) {
190const API_KEY = getApiKey();
191const genAI = new GoogleGenerativeAI(API_KEY);
192return genAI.getGenerativeModel(params);
193}
915<div class="mt-2">
916<p>Use this to detect bounding boxes of objects in an image. Use the image description to help with setting up the prompt. Rows and columns determine how many tiles the image will be divided into — for simple images, 1x1 is best.</p>
917<p>For the free API you might get the "Resource has been exhausted" error if you make too many requests too quickly.</p>
918<textarea id="promptInput" rows=6>Identify and return bounding boxes of the (MAIN SUBJECT) \n[ymin, xmin, ymax, xmax]</textarea>
919<div class="checkbox-container my-2">