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/image-url.jpg%20%22Optional%20title%22?q=api&page=1385&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 17621 results for "api"(4909ms)

OpenAImain.tsx7 matches

@It_FITS_Marketing•Updated 8 months ago
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
17 * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
18 * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
26 });

stockAPImain.tsx4 matches

@pete•Updated 8 months ago
1import { parse } from "https://deno.land/std@0.181.0/flags/mod.ts";
2
3const ALPHA_VANTAGE_API_KEY = "your_api_key_here"; // Replace with your actual API key
4
5async function fetchStockData(symbol: string) {
6 const apiUrl =
7 `https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${ALPHA_VANTAGE_API_KEY}`;
8 const response = await fetch(apiUrl);
9 const data = await response.json();
10

renderPoemWidgetJsonmain.tsx2 matches

@crsven•Updated 8 months ago
13 timeZone,
14 };
15 const timeForApi = date.toLocaleTimeString("en-GB", {
16 ...baseTimeParams,
17 hourCycle: "h23",
18 });
19 const poem = await getPoemForTime(timeForApi);
20 const newState = { ...poemWidgetJson };
21 newState.layouts.hello_small.layers[0].rows[0].cells[0].text.string = poem;

stockAPIREADME.md2 matches

@pete•Updated 8 months ago
1This Val accepts a stock symbol and will return current price and intraday price change.
2
3example: `https://pete-stockapi.web.val.run/symbol=MSFT`
4
5It's currently using alphavantage free tier API so it's limited to only 25 requests/day. Fork and create your own premium API key for more request.

placeholderKittenImagesmain.tsx1 match

@ashryanio•Updated 8 months ago
1// This val creates a publicly accessible kitten image generator using the Val Town image generation API.
2// It supports generating square images with a single dimension parameter or rectangular images with two dimension parameters.
3

FanFicScrapermain.tsx19 matches

@willthereader•Updated 8 months ago
11 e.preventDefault();
12 setLoading(true);
13 console.log(`Submitting URL for scraping: ${url}`);
14 try {
15 const response = await fetch("/scrape", {
22 setResult(data);
23 } catch (error) {
24 console.log(`Error occurred while scraping URL: ${url}. Error details: ${error.message}`);
25 setResult({ error: error.message });
26 }
40 />
41 <button type="submit" disabled={loading}>
42 {loading ? "Scraping..." : "Scrape"}
43 </button>
44 </form>
79async function scrapePage(url) {
80 console.log(`Starting to scrape page: ${url}`);
81 const apiKey = Deno.env.get("ScrapingBeeAPIkey");
82 if (!apiKey) {
83 console.log("ScrapingBee API key not found in environment variables");
84 throw new Error("ScrapingBee API key not found in environment variables");
85 }
86
104 };
105
106 console.log(`Sending request to ScrapingBee for URL: ${url} at ${new Date().toISOString()}`);
107 const startTime = Date.now();
108 try {
109 const response = await fetch(
110 `https://app.scrapingbee.com/api/v1/?api_key=${apiKey}&url=${
111 encodeURIComponent(url)
112 }&render_js=false&extract_rules=${encodeURIComponent(JSON.stringify(extractRules))}`,
114
115 const duration = Date.now() - startTime;
116 console.log(`Received response from ScrapingBee at ${new Date().toISOString()}. Duration: ${duration}ms`);
117 console.log(`Received response from ScrapingBee for URL: ${url}. Status: ${response.status}`);
118
119 if (!response.ok) {
120 console.log(`Error response from ScrapingBee. Status: ${response.status}`);
121 throw new Error(`HTTP error! status: ${response.status}`);
122 }
156 return result;
157 } catch (error) {
158 console.log(`Error occurred while scraping URL: ${url}`);
159 console.log(`Error details: ${error.message}`);
160 console.log(`Error stack: ${error.stack}`);
163}
164
165async function getApiKey() {
166 const apiKey = Deno.env.get("ScrapingBeeAPIkey");
167 if (!apiKey) {
168 console.log("ScrapingBee API key not found in environment variables");
169 throw new Error("ScrapingBee API key not found in environment variables");
170 }
171 return apiKey;
172}
173

getBlobAndRenderAsImageREADME.md4 matches

@ashryanio•Updated 8 months ago
8
9To easily upload an image to your blob storage, [fork this val](
10getBlobAndRenderAsImage), run it, and enter your API key in the password input.
11
12## How it works
21
22 - The server function calls `blob.get("test.png")`.
23 - This `blob.get()` method makes an HTTP request to the Val Town API.
24 - The API returns a Response object containing the image data.
25
26
64
65- [Blob storage overview in Val Town docs](https://docs.val.town/std/blob/)
66- [Val Town REST API references for blobs](https://docs.val.town/openapi#tag/blobs)
67- [Val Town blob std lib source code](https://www.val.town/v/std/blob)

blob_adminREADME.md1 match

@ashryanio•Updated 8 months ago
9[![](https://stevekrouse-button.express.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO

zygomorphicPurpleStoatREADME.md1 match

@seanodotcom•Updated 8 months ago
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12

redditSearchmain.tsx5 matches

@nicosql•Updated 8 months ago
11interface RedditSearchOptions {
12 query: string;
13 apiKey?: string;
14}
15
17export async function redditSearch({
18 query,
19 apiKey = Deno.env.get("BROWSERBASE_API_KEY"),
20}: RedditSearchOptions): Promise<ThreadResult[]> {
21 if (!apiKey) {
22 throw new Error("BrowserBase API key is required");
23 }
24
25 const puppeteer = new PuppeteerDeno({ productName: "chrome" });
26 const browser = await puppeteer.connect({
27 browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${apiKey}&enableProxy=true`,
28 ignoreHTTPSErrors: true,
29 });

RandomQuoteAPI

@Freelzy•Updated 23 hours ago

HAPI7 file matches

@dIgitalfulus•Updated 1 day ago
Kapil01
apiv1