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?q=api&page=1031&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 13623 results for "api"(1187ms)

masterPancakeCheckermain.tsx2 matches

@bpughUpdated 9 months ago
6import { email } from "https://esm.town/v/std/email";
7
8const THEATER_API = "https://drafthouse.com/s/mother/v2/schedule/collection/austin/master-pancake";
9const STORAGE_KEY = "alamo_showings";
10
11async function fetchShowings() {
12 const response = await fetch(THEATER_API);
13 return await response.json();
14}

AlgoliaRecordSender2main.tsx4 matches

@willthereaderUpdated 9 months ago
1// Importing environment variables
2const ALGOLIA_APP_ID = Deno.env.get("ALGOLIA_APP_ID");
3const ALGOLIA_WRITE_API_KEY = Deno.env.get("ALGOLIA_WRITE_API_KEY");
4const ALGOLIA_INDEX_NAME = "Test_index";
5
227 "chapterTitle": "A Side Ws",
228 "chapterNumber": 1,
229 "content": "If Hitler were president she'd have to obey him. Someone forced her to put people in the Birdcage when she didn't want to, but other times left her orders vague and unclear? Gave her loopholes? Who had legal authority over Dragon? \"You don't have to ask stupid questions,\" Forecast suggested. \"You're smart enough to figure out what was going on. Why Dragon was afraid of being used. Why Taylor and Veda were working with Armsmaster to set her free.\" She paused, a hiss escaping her breath from wherever she was. \"No one deserves to be a slave, to be used for what they are with no care for who they are.\" The PRT. No, the Triumvirate. \"You're saying Alexandria knew.\" Forecast didn't answer at first. She waited a second and then another. \"You don't need me to answer that,\" she stated confidently. \"They were trying to free her?\" Halberd asked. \"Break the restrictions?\" \"Yes. The only problem was the Dragonslayers.",
230 "startIndex": 378,
231 "endIndex": 398,
491 "chapterTitle": "A Side Ws",
492 "chapterNumber": 1,
493 "content": "Chambers downed his drink rapidly. \"Well. Good luck with that, but I'll warn you now that no one likes watching criminals go free, even if they have a sad story.\" \"I do not need to find a way to let them out,\" Veda declared. \"I already possess one.\" \"You can't do that,\" Banks snapped. \"You don't have the—\" \"Newtype is presently in the process of releasing Jillian Monroe, Thomas Heyworth, Cecil Nunyez, and Veronica Lyod from confinement. We will be returning them home this afternoon.\" Eyes widened and more shouts started to fill the room. Kamil settled into his seat, thinking. \"I trust that the PRT will respect that all four of these individuals are definitively innocent of the crimes that put them in the Birdcage.\" That was a warning. \"How?\" Seneca asked, her voice making it through all the others. \"How are you getting them out?\" \"Through the Birdcage's own inbuilt systems… You are unaware of this?\" Kamil raised his brow again. \"You're saying that there is a way out of the Birdcage? It's part of the prison itself?\" \"It is. I have access to several detailed requests Dragon made to the PRT.",
494 "startIndex": 840,
495 "endIndex": 860,
662 const headers = {
663 "Content-Type": "application/json",
664 "X-Algolia-API-Key": ALGOLIA_WRITE_API_KEY,
665 "X-Algolia-Application-Id": ALGOLIA_APP_ID,
666 };

egoBoostermain.tsx2 matches

@stevekrouseUpdated 9 months ago
2 * This ego booster app takes a selfie, sends it to GPT-4o-mini for analysis,
3 * and streams funny, specific compliments about the user's appearance.
4 * We use the WebRTC API for camera access, the OpenAI API for image analysis,
5 * and server-sent events for real-time streaming of compliments.
6 */
259
260const css = `
261 @import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Poppins:wght@400;600&display=swap');
262
263 body {

lovelyBeigeSolemain.tsx1 match

@megladoUpdated 9 months ago
96 const data = await response;
97 const update = await fetch(
98 `https://discord.com/api/v10/webhooks/${body.application_id}/${body.token}/messages/@original`,
99 {
100 method: "PATCH",

discordBotmain.tsx1 match

@megladoUpdated 9 months ago
96 const data = await response;
97 const update = await fetch(
98 `https://discord.com/api/v10/webhooks/${body.application_id}/${body.token}/messages/@original`,
99 {
100 method: "PATCH",

password_authREADME.md1 match

@cofsanaUpdated 9 months ago
19```
20
21If you want to use an [api token](https://www.val.town/settings/api) to authenticate:
22
23```ts

VALLErunmain.tsx11 matches

@cofsanaUpdated 9 months ago
211 Make an HTTP val (other vals are currently not supported to run, even though we have examples for them).
212 Start your response with a comment explaining how your approach will work, what libraries or
213 API calls you will use, and any tradeoffs you're making. Then write the code in a consise way,
214 the simplest way to achieve the goal, though you can add some inline comments to explain your
215 reasoning (not for every line, but for major groups of lines). Don't use any environment variables
216 unless strictly necessary, for example use APIs that don't require a key, prefer internal function
217 imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
218 functions where possible. Unless specified, don't add error handling,
219 make sure that errors bubble up to the caller.
220 Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
221 not practical for the user's request (e.g. if they ask for a particular animated gif).
222 If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
223 explicitly specified otherwise. Use the current val name for the storage key, which you can get
224 using the "pomdtr/extractValInfo" val, which you can call like this:
273Make an HTTP val (other vals are currently not supported to run, even though we have examples for them).
274Add comments at the top of the file explaining how your approach works, what libraries or
275API calls you will use, and any tradeoffs you're making. Then write the code in a consise way,
276the simplest way to achieve the goal, though you can add some inline comments to explain your
277reasoning (not for every line, but for major groups of lines). Don't use any environment variables
278unless strictly necessary, for example use APIs that don't require a key, prefer internal function
279imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
280functions where possible. Unless specified, don't add error handling,
281make sure that errors bubble up to the caller.
282Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
283not practical for the user's request (e.g. if they ask for a particular animated gif).
284If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
285explicitly specified otherwise. Use the current val name for the storage key, which you can get
286using the "pomdtr/extractValInfo" val, which you can call like this:
389 \`\`\`
390
391 ### Lower-level API
392
393 We do provide access to the lower-level getter and setters, which are useful if you are storing non-JSON or binary data, need to stream in your response or request data, or do anything else lower-level.
394
395 - \`async get(key: string)\`: Retrieves a blob for a given key.
396 - \`async set(key: string, value: string | BodyInit)\`: Sets the blob value for a given key. See [BodyInit](https://deno.land/api@v1.38.1?s=BodyInit).
397
398 ### Limitations
1204
1205 const tempValName = `valle_tmp_${Math.random() * 10}`.replaceAll(".", "");
1206 // Errors in running the val bubble up through this API, so ignore them.
1207 await vt.vals.create({ name: tempValName, code: newCode, type: "http" as any, privacy: "unlisted" }).catch(
1208 (error) => {

WikiImagemain.tsx29 matches

@amppUpdated 9 months ago
36
37async function enhancedWikipediaSearch(pageName: string): Promise<any | null> {
38 const apiUrl = new URL("https://en.wikipedia.org/w/api.php");
39 apiUrl.searchParams.append("action", "query");
40 apiUrl.searchParams.append("list", "search");
41 apiUrl.searchParams.append("srsearch", pageName);
42 apiUrl.searchParams.append("srnamespace", "0");
43 apiUrl.searchParams.append("srlimit", "1");
44 apiUrl.searchParams.append("format", "json");
45
46 const response = await fetch(apiUrl.toString());
47 const data = await response.json();
48
60 }
61
62 const apiUrl = new URL("https://en.wikipedia.org/w/api.php");
63 apiUrl.searchParams.append("action", "query");
64 apiUrl.searchParams.append("titles", searchResult.title);
65 apiUrl.searchParams.append("prop", "pageimages|extracts|info|images|pageprops");
66 apiUrl.searchParams.append("piprop", "original|name");
67 apiUrl.searchParams.append("pithumbsize", "1000");
68 apiUrl.searchParams.append("pilimit", "1");
69 apiUrl.searchParams.append("exintro", "1");
70 apiUrl.searchParams.append("explaintext", "1");
71 apiUrl.searchParams.append("redirects", "1");
72 apiUrl.searchParams.append("inprop", "url");
73 apiUrl.searchParams.append("format", "json");
74
75 const response = await fetch(apiUrl.toString());
76 const data = await response.json();
77
78 console.log("API Response:", JSON.stringify(data, null, 2));
79
80 if (!data.query || !data.query.pages) {
134 filename = filename.replace(/^File:/, "");
135
136 const apiUrl = new URL("https://en.wikipedia.org/w/api.php");
137 apiUrl.searchParams.append("action", "query");
138 apiUrl.searchParams.append("titles", `File:${filename}`);
139 apiUrl.searchParams.append("prop", "imageinfo");
140 apiUrl.searchParams.append("iiprop", "url|size");
141 apiUrl.searchParams.append("format", "json");
142
143 const response = await fetch(apiUrl.toString());
144 const data = await response.json();
145

twitchmain.tsx2 matches

@pinjasaurUpdated 9 months ago
14 }
15 try {
16 // https://api.twitch.tv/helix/schedule/icalendar?broadcaster_id=95536715
17 const url = new URL("https://api.twitch.tv/helix/schedule/icalendar");
18 url.searchParams
19 .set("broadcaster_id", params.get("broadcaster_id"));

YouTubeSubmissionsmain.tsx3 matches

@mvmattgrayUpdated 9 months ago
2// We'll use the built-in Request and Response objects for handling HTTP.
3// The form fields are customized for video information collection.
4// We'll add JSON API endpoints for Framer Fetch integration.
5
6import { blob } from "https://esm.town/v/std/blob";
11 const url = new URL(req.url);
12
13 // API endpoints for Framer Fetch
14 if (url.pathname === "/api/entries") {
15 if (req.method === "GET") {
16 const entries = await blob.getJSON(KEY).catch(() => []) || [];

create-val-api-demo1 file match

@shouserUpdated 11 hours ago

new-val-api-demo

@shouserUpdated 11 hours ago
This is an example of using the API to create a val.
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration