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/$%7Bart_info.art.src%7D?q=api&page=917&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 12831 results for "api"(2740ms)

bookReservationOnResymain.tsx7 matches

@ireneg•Updated 7 months ago
30}) => {
31 const { z } = await import("npm:zod");
32 const RESY_API_URL = "https://api.resy.com";
33 const RESY_DEFAULT_HEADERS = {
34 accept: "application/json, text/plain, */*",
35 "accept-encoding": "gzip, deflate, br",
36 "accept-language": "en-US,en;q=0.9",
37 authorization: "ResyAPI api_key=\"VbWk7s3L4KiK5fzlO7JD3Q5EYolJI7n5\"",
38 "x-origin": "https://resy.com",
39 origin: "https://resy.com/",
145 )
146 }&password=${encodeURIComponent(params.password)}`;
147 const response = await fetch(`${RESY_API_URL}/3/auth/password`, {
148 method: "POST",
149 body: body,
166 seats: number;
167 }) => {
168 const url = `${RESY_API_URL}/3/details`;
169 const response = await fetch(url.toString(), {
170 method: "POST",
185 seats: number;
186 }) => {
187 const url = `${RESY_API_URL}/4/find`;
188 const searchParams = new URLSearchParams();
189 searchParams.set("lat", "0");
208 city: string;
209 }) => {
210 const url = `${RESY_API_URL}/3/venue`;
211 const searchParams = new URLSearchParams();
212 searchParams.set("url_slug", params.slug);
224 authToken: string;
225 }) => {
226 const response = await fetch(`${RESY_API_URL}/3/book`, {
227 method: "POST",
228 headers: {

v2FanFicScrapermain.tsx30 matches

@willthereader•Updated 7 months ago
11 e.preventDefault();
12 setLoading(true);
13 console.log(`Submitting URL for scraping: ${url}`);
14
15 const maxRetries = 3;
28 if (!response.ok) {
29 if (response.status === 400) {
30 throw new APIError("Bad request. Check your parameters.", response.status);
31 } else if (response.status === 401) {
32 throw new APIError("No more credit available. Please upgrade your plan.", response.status);
33 } else if (response.status === 404) {
34 throw new APIError("Requested URL not found.", response.status);
35 } else if (response.status === 429) {
36 throw new APIError("Too many concurrent requests. Please upgrade your plan.", response.status);
37 } else {
38 throw new APIError(`HTTP error! status: ${response.status}`, response.status);
39 }
40 }
44 break; // Exit the loop if successful
45 } catch (error) {
46 console.log(`Error occurred while scraping URL: ${url}. Error details: ${error.message}`);
47
48 if (error.name === "TypeError" && error.message === "Failed to fetch") {
76 />
77 <button type="submit" disabled={loading}>
78 {loading ? "Scraping..." : "Scrape"}
79 </button>
80 </form>
130async function scrapePage(url) {
131 console.log(`Starting to scrape page: ${url}`);
132 const apiKey = await getApiKey();
133
134 url = normalizeUrl(url);
135 console.log(`Normalized URL for scraping: ${url}`);
136
137 const extractRules = {
161 };
162
163 const result = await scrapePageWithRules(url, apiKey, extractRules);
164 return processResults(result);
165}
186}
187
188class APIError extends Error {
189 constructor(message, status) {
190 super(message);
191 this.name = "APIError";
192 this.status = status;
193 }
201}
202
203async function scrapePageWithRules(url, apiKey, extractRules) {
204 console.log(`Sending request to ScrapingBee API for URL: ${url}`);
205 try {
206 const response = await fetch(
207 `https://app.scrapingbee.com/api/v1/?api_key=${apiKey}&url=${
208 encodeURIComponent(url)
209 }&render_js=true&json_response=true&extract_rules=${encodeURIComponent(JSON.stringify(extractRules))}`,
211
212 if (!response.ok) {
213 throw new APIError(`HTTP error! status: ${response.status}`, response.status);
214 }
215
216 console.log("Response received from ScrapingBee API");
217 console.log(`Cost: ${response.headers.get("Spb-cost")}`);
218 console.log(`Initial status code: ${response.headers.get("Spb-initial-status-code")}`);
226 }
227
228 console.log("ScrapingBee API response parsed successfully");
229 return result;
230 } catch (error) {
231 if (error instanceof TypeError) {
232 console.error("Network error:", error.message);
233 throw new NetworkError("Failed to connect to the API");
234 } else if (error instanceof APIError) {
235 console.error("API error:", error.message, "Status:", error.status);
236 throw error;
237 } else if (error instanceof ParsingError) {
286}
287
288async function getApiKey() {
289 const apiKey = Deno.env.get("ScrapingBeeAPIkey");
290 if (!apiKey) {
291 console.log("ScrapingBee API key not found in environment variables");
292 throw new Error("ScrapingBee API key not found in environment variables");
293 }
294 return apiKey;
295}
296
302 const result = await scrapePage(url);
303 console.log(`Successfully scraped URL: ${url}`);
304 console.log(`Scraping completed for URL: ${url}
305 Result summary:
306 Title: ${result.title}
312 console.log(`Error occurred while processing request. Error details: ${error.message}`);
313 console.log(`Error stack trace: ${error.stack}`);
314 console.error(`Error occurred during scraping operation:
315 Error message: ${error.message}
316 Stack trace:

zottifymain.tsx1 match

@rapfl•Updated 7 months ago
5
6const replicate = new Replicate({
7 auth: Deno.env.get("REPLICATE_API_TOKEN"),
8});
9

whoIsHiringmain.tsx4 matches

@stevekrouse•Updated 7 months ago
63 const fetchStories = async () => {
64 try {
65 const response = await fetch("/api/stories");
66 if (!response.ok) throw new Error("Failed to fetch dates");
67 const data = await response.json();
77 try {
78 dispatch({ type: "loading", value: true });
79 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80 if (!response.ok) throw new Error("Failed to fetch comments");
81 const data = await response.json();
360export default async function(req: Request): Promise<Response> {
361 const url = new URL(req.url);
362 if (url.pathname === "/api/stories") {
363 const storySearch = await hnSearch({
364 search_by_date: true,
381 }
382
383 if (url.pathname === "/api/comments") {
384 const params = url.searchParams;
385 const query = params.get("query") || "";

imagesToPDFmain.tsx1 match

@g•Updated 7 months ago
6 * 2. Use JavaScript to handle file selection and PDF generation
7 * 3. Utilize the jsPDF library for PDF creation
8 * 4. Use the FileReader API to read image files
9 *
10 * The application will not modify or convert the images, and each PDF page

bedtimeStoryMakermain.tsx1 match

@dthyresson•Updated 7 months ago
1/** @jsxImportSource npm:hono@3/jsx */
2import { Unkey } from "npm:@unkey/api@0.26.1";
3import { Ratelimit } from "npm:@unkey/ratelimit@0.4.4";
4import type { Duration } from "npm:@unkey/ratelimit@0.4.4";

generativeFillmain.tsx1 match

@jeffreyyoung•Updated 7 months ago
3
4const replicate = new Replicate({
5 auth: Deno.env.get("REPLICATE_API_KEY"),
6});
7//

sqliteExplorerAppREADME.md1 match

@flymaster•Updated 8 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerAppmain.tsx2 matches

@flymaster•Updated 8 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

terribleTanCatmain.tsx2 matches

@kamillydka•Updated 8 months ago
30type Test<T extends string = TwoLettersString> = T;
31
32type CapitalizeTwoLetterString<T extends string, U extends string = TwoLettersString> = T extends U ? Capitalize<T>
33 : never;
34
35type fullName = `${CapitalizeTwoLetterString<"a">} ${CapitalizeTwoLetterString<"df", TwoLettersString>}`;
36
37const fn: never = "1" as undefined as never;

vapi-minutes-db1 file match

@henrywilliams•Updated 1 day ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 1 day ago
snartapi
papimark21