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/?q=api&page=954&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 11919 results for "api"(1540ms)

manifold_daily_loan_collectormain.tsx2 matches

@caseUpdated 1 year ago
1export default async function() {
2 const res = await fetch("https://api.manifold.markets/request-loan", {
3 headers: {
4 Authorization: `Key ${Deno.env.get("manifoldApiKey")}`,
5 },
6 });

untitled_redTurtlemain.tsx12 matches

@devdoshiUpdated 1 year ago
1import { swaggerUI } from "npm:@hono/swagger-ui";
2import { z } from "npm:@hono/zod-openapi";
3import { createRoute, OpenAPIHono } from "npm:@hono/zod-openapi";
4import { html } from "npm:hono/html";
5
8 .string()
9 .min(3)
10 .openapi({
11 param: {
12 name: "id",
19const UserSchema = z
20 .object({
21 id: z.string().openapi({
22 example: "123",
23 }),
24 name: z.string().openapi({
25 example: "John Doe",
26 }),
27 age: z.number().openapi({
28 example: 42,
29 }),
30 })
31 .openapi("User");
32
33const route = createRoute({
49});
50
51const app = new OpenAPIHono();
52
53app.get("/", c => c.html(html`Try going to <a href="/ui">/ui</a>`));
54
55app.openapi(route, (c) => {
56 const { id } = c.req.valid("param");
57 return c.json({
62});
63
64// The OpenAPI documentation will be available at /doc
65app.doc("/doc", {
66 openapi: "3.0.0",
67 info: {
68 version: "1.0.0",
69 title: "My API",
70 },
71});

manifold_daily_loan_collectorREADME.md2 matches

@caseUpdated 1 year ago
3Instructions:
41. Fork this Val.
52. Get your Manifold API key [from your profile](https://manifold.markets/profile).
63. Add `manifoldApiKey` with your key to the [Val Environment Variables](https://www.val.town/settings/environment-variables).
74. Hit run! It will run daily to collect your loans.
8

remarkmain.tsx3 matches

@stevekrouseUpdated 1 year ago
10 <style>
11 {`
12 @import url(https://fonts.googleapis.com/css?family=Droid+Serif);
13 @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
14 @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
15
16 body {

twemojimain.tsx7 matches

@stevedylandevUpdated 1 year ago
35}
36
37export const apis = {
38 twemoji: (code: string) =>
39 `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${
56const emojiCache: Record<string, Promise<string>> = {};
57
58export async function loadEmoji (type: keyof typeof apis, code: string) {
59 const key = `${type}:${code}`;
60
63 }
64
65 if (!type || !apis[type]) {
66 type = "twemoji";
67 }
68
69 const api = apis[type];
70
71 if (typeof api === "function") {
72 return (emojiCache[key] = fetch(api(code)).then(async r => r.text()));
73 }
74 return (emojiCache[key] = fetch(`${api}${code.toUpperCase()}.svg`).then(async r =>
75 r.text()));
76}

getWeathermain.tsx6 matches

@chetUpdated 1 year ago
2import process from "node:process";
3
4/** Must set process.env.WEATHER_API_KEY for weatherapi.com **/
5export async function getWeather(
6 query: string,
7 days = 10,
8): Promise<WeatherApiResponse> {
9 const weatherApiKey = process.env.WEATHER_API_KEY;
10 const q = encodeURIComponent(query);
11 const apiUrl = `https://api.weatherapi.com/v1/forecast.json?key=${weatherApiKey}&q=${q}&days=${days}`;
12 const response = await fetch(apiUrl);
13 const data: any = await response.json();
14 return data;
15}
16
17type WeatherApiResponse = {
18 location: {
19 name: string;

MusicAPI2README.md4 matches

@nishuiUpdated 1 year ago
1API:`https://nishui-MusicAPI2.web.val.run?id=xxx`
2
3id 是网易云的音乐 id 值,使用此 API 将会访问网页的两个 API 去获取音乐信息和歌词信息
4
5我们用 req.url 获取 API 的url,然后再获取 url 的参数 id,这样就获取到对应的参数 id 了
6
72024年03月25日 不知道什么原因,获取 song 的 detail 失败,说是 `querystring/url must match format \"uri\`
8
9Migrated from folder: MusicPlatform/MusicAPI2

greenhouseToRSSmain.tsx2 matches

@donmccurdyUpdated 1 year ago
6 const account = searchParams.get("account");
7 const mode = searchParams.get("mode");
8 const SOURCE_URL = `https://boards-api.greenhouse.io/v1/boards/${account}/jobs`;
9 const { jobs: sourceJobs } = await fetch(SOURCE_URL).then((res) => res.json());
10
12 const feed = new Feed({
13 title: `Jobs: ${account} (via Greenhouse)`,
14 description: "Job postings automatically forwarded from Greenhouse API to RSS.",
15 id: getFeedLink(mode),
16 link: "https://www.val.town/v/donmccurdy.greenhouseToRSS",

leverToRSSmain.tsx1 match

@donmccurdyUpdated 1 year ago
7 const account = searchParams.get("account");
8 const mode = searchParams.get("mode");
9 const SOURCE_URL = `https://api.lever.co/v0/postings/${account}?mode=xml`;
10 const parser = new XMLParser();
11 const sourceXML = await fetch(SOURCE_URL).then((res) => res.text());

createValmain.tsx1 match

@neverstewUpdated 1 year ago
39 };
40
41 return fetchJSON("https://api.val.town/v1/vals", {
42 headers: {
43 Authorization: `Bearer ${token}`,

social_data_api_project3 file matches

@tsuchi_yaUpdated 27 mins ago

simple-scrabble-api1 file match

@bryUpdated 2 days ago
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