Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bsuccess?q=api&page=1487&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 21670 results for "api"(4455ms)

askSMHI

askSMHImoderation1 match

@ljus•Updated 3 months ago
9 Authorization: `Bearer ${openAIKey}`,
10 };
11 const openai = new OpenAI({ apiKey: process.env.OPENAI_CHAT });
12 const responseData = await openai.moderations.create({ input: publicMessages });
13 return { flagged: responseData.results.some((r) => r.flagged) };

newCerebrasModelAlertmain.tsx2 matches

@stevekrouse•Updated 3 months ago
7 const historicalModels = await blob.getJSON("cerebras-models.json");
8
9 const currentModels = await fetchJSON("https://api.cerebras.ai/v1/models", {
10 bearer: Deno.env.get("CEREBRAS_API_KEY"),
11 });
12 await blob.setJSON("cerebras-models.json", currentModels);

OpenTowniesoundEffects.ts4 matches

@stevekrouse•Updated 3 months ago
4
5/**
6 * Plays a bell sound notification using the Web Audio API
7 * @returns A Promise that resolves when the sound has started playing
8 */
13 const AudioContext = window.AudioContext || (window as any).webkitAudioContext;
14 if (!AudioContext) {
15 console.warn("Web Audio API not supported in this browser");
16 resolve();
17 return;
65
66/**
67 * Plays a simple notification sound using the Web Audio API
68 * This is a simpler, shorter bell sound
69 * @returns A Promise that resolves when the sound has started playing
75 const AudioContext = window.AudioContext || (window as any).webkitAudioContext;
76 if (!AudioContext) {
77 console.warn("Web Audio API not supported in this browser");
78 resolve();
79 return;

instagramScrapingREADME.md1 match

@wolf•Updated 3 months ago
6
7- `/` - Main application page
8- `/extract?url={instagram_url}` - API endpoint to extract post data
9- `/extract?url={instagram_url}&proxyImage=true` - Endpoint to proxy Instagram images
10

BingImageOfDayREADME.md4 matches

@wolf•Updated 3 months ago
1# Bing Image of the Day Archive
2
3This Val Town project fetches, displays, and archives the Bing Image of the Day, providing an API to access both current and historical images.
4
5## Overview
10- Retrieve specific historical images by date
11
12## API Endpoints
13
14| Endpoint | Method | Description |
18| `/get/:date` | GET | Returns a specific archived image by date (format: MM-DD-YYYY) |
19| `/backup` | GET | Manually triggers a backup of the current Bing Image of the Day |
20| `/docs` | GET | Returns API documentation in JSON format |
21
22### How It Works
24- The service scrapes the Bing image from a public source (bing.gifposter.com)
25- Images are stored in Val Town's blob storage with keys in the format `bing-images-of-day/MM-DD-YYYY.jpg`
26- The main API serves both current and archived images with proper caching headers
27- Automation can be set up to trigger the backup endpoint daily to build a complete archive
28

AlwaysHereBackendREADME.md5 matches

@ninadxc•Updated 3 months ago
8## Hono
9
10This app uses [Hono](https://hono.dev/) as the API framework. You can think of Hono as a replacement for [ExpressJS](https://expressjs.com/) that works in serverless environments like Val Town or Cloudflare Workers. If you come from Python or Ruby, Hono is also a lot like [Flask](https://github.com/pallets/flask) or [Sinatra](https://github.com/sinatra/sinatra), respectively.
11
12## Serving assets to the frontend
20### `index.html`
21
22The most complicated part of this backend API is serving index.html. In this app (like most apps) we serve it at the root, ie `GET /`.
23
24We *bootstrap* `index.html` with some initial data from the server, so that it gets dynamically injected JSON data without having to make another round-trip request to the server to get that data on the frontend. This is a common pattern for client-side rendered apps.
25
26## CRUD API Routes
27
28This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
29
30## Errors
31
32Hono and other API frameworks have a habit of swallowing up Errors. We turn off this default behavior by re-throwing errors, because we think most of the time you'll want to see the full stack trace instead of merely "Internal Server Error". You can customize how you want errors to appear.

reactHonoExamplegoogleOAuth.ts2 matches

@varun1352•Updated 3 months ago
15
16 // Exchange code for tokens
17 const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
18 method: "POST",
19 headers: { "Content-Type": "application/x-www-form-urlencoded" },
30
31 // Fetch user info
32 const userInfoResponse = await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
33 headers: { Authorization: `Bearer ${access_token}` },
34 });

reactHonoExampleindex.ts2 matches

@varun1352•Updated 3 months ago
3import { Hono } from "npm:hono";
4
5// Import your API routes
6import { googleOAuth } from "./auth/googleOAuth.ts";
7// Later: import userApi from "./api/user.ts"; etc.
8
9const app = new Hono();

AlwaysHereindex.ts11 matches

@varun1352•Updated 3 months ago
2import { Hono } from "npm:hono";
3
4// Import API handlers
5import chatApi from "./api/chat.ts";
6import friendsApi from "./api/friends.ts";
7import recordingsApi from "./api/recordings.ts";
8import transcriptsApi from "./api/transcripts.ts";
9import userApi from "./api/user.ts";
10import googleOAuth from "./auth/googleOAuth.ts";
11import { createTables } from "./database/migrations.ts";
21});
22app.route("/auth/google", googleOAuth);
23app.route("/api/user", userApi);
24app.route("/api/friends", friendsApi);
25app.route("/api/recordings", recordingsApi);
26app.route("/api/chat", chatApi);
27app.route("/api/transcripts", transcriptsApi);
28
29// 🌎 Error handling

AlwaysHeregoogleOAuth.ts2 matches

@varun1352•Updated 3 months ago
15
16 // Exchange code for tokens
17 const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
18 method: "POST",
19 headers: { "Content-Type": "application/x-www-form-urlencoded" },
30
31 // Fetch user info
32 const userInfoResponse = await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
33 headers: { Authorization: `Bearer ${access_token}` },
34 });

github-api8 file matches

@cricks_unmixed4u•Updated 1 day ago
Very incomplete collection of useful GitHub API adapters

telegram1 file match

@ledudu•Updated 3 days ago
中转telegram api
Kapil01
apiv1