23const browser = await puppeteer.connect({
4browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
5})
6
efficientWhiteBobolinkmain.tsx3 matches
13setError("");
14try {
15const res = await fetch(`${window.location.origin}/api`, {
16method: 'POST',
17headers: {
123const url = new URL(req.url);
124125if (req.method === "POST" && url.pathname === "/api") {
126try {
127const { domain } = await req.json();
130}
131132const firecrawlResponse = await fetch("https://api.firecrawl.dev/v1/map", {
133method: "POST",
134headers: {
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}