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=87&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"(1943ms)

Townieindex.ts7 matches

@devdoshiUpdated 4 days ago
1import { basicAuthMiddleware } from "./auth.ts";
2import { handleApiRequest } from "./api/index.ts";
3import { getRequests } from "./api/requests.ts";
4import { getUserSummary } from "./api/user-summary.ts";
5import { getInferenceCalls } from "./api/inference-calls.ts";
6import { renderDashboard } from "./views/dashboard.ts";
7import { renderRequests } from "./views/requests.ts";
22 const path = url.pathname;
23
24 // Handle API requests
25 if (path.startsWith("/api/")) {
26 return handleApiRequest(req);
27 }
28

Townieindex.ts5 matches

@devdoshiUpdated 4 days ago
4
5/**
6 * Handle API requests
7 */
8export async function handleApiRequest(req: Request): Promise<Response> {
9 const url = new URL(req.url);
10 const path = url.pathname.replace("/api/", "");
11
12 try {
13 // Route to the appropriate API handler
14 if (path === "requests") {
15 const usageId = url.searchParams.get("usage_id");
59 }
60 } catch (error) {
61 console.error("API error:", error);
62 return new Response(JSON.stringify({ error: error.message }), {
63 status: 500,

TownieHome.tsx5 matches

@devdoshiUpdated 4 days ago
42 </h2>
43 <ol>
44 <li>Login with your Val Town API token (with projects:read, projects:write, user:read permissions)</li>
45 <li>Select a project to work on</li>
46 <li>Chat with Claude about your code</li>
79 </div>
80 <h3>Cost Tracking</h3>
81 <p>See estimated API usage costs for each interaction</p>
82 </div>
83 </section>
92 <ul>
93 <li>React frontend with TypeScript</li>
94 <li>Hono API server backend</li>
95 <li>Web Audio API for sound notifications</li>
96 <li>AI SDK for Claude integration</li>
97 </ul>
98 <p>
99 The application proxies requests to the Anthropic API and Val Town API, allowing Claude to view and edit your
100 project files directly.
101 </p>

social_data_api_projectproxy-api.ts23 matches

@tsuchi_yaUpdated 4 days ago
1/**
2 * SocialData API Proxy for Cloudflare Workers
3 * Acts as a backend for the X Search UI, handling API key management,
4 * and request forwarding to SocialData API.
5 *
6 * This proxy runs on Cloudflare Workers and connects to:
7 * - Supabase for authentication and user management
8 * - Cloudflare D1 for tweet storage
9 * - SocialData API for Twitter/X data
10 */
11
41 try {
42 // Supabaseの公開鍵を使ってJWTを検証するのが理想ですが、
43 // 簡易的な実装としてSupabase APIを利用して検証します
44 const supabaseUrl = env.SUPABASE_URL;
45 const supabaseKey = env.SUPABASE_SERVICE_KEY;
50 }
51
52 // Supabase Auth APIを利用してユーザー情報を取得
53 const response = await fetch(`${supabaseUrl}/auth/v1/user`, {
54 headers: {
55 "Authorization": `Bearer ${token}`,
56 "apikey": supabaseKey,
57 },
58 });
69 headers: {
70 "Authorization": `Bearer ${supabaseKey}`,
71 "apikey": supabaseKey,
72 },
73 });
104
105/**
106 * Forward request to SocialData API
107 * @param {string} query - Search query
108 * @param {string} type - Search type (Latest or Top)
113async function forwardToSocialData(query, type, cursor, env) {
114 try {
115 const apiKey = env.SOCIAL_DATA_API_KEY;
116 if (!apiKey) {
117 throw new Error("SOCIAL_DATA_API_KEY environment variable not set");
118 }
119
120 const apiUrl = new URL("https://api.socialdata.tools/twitter/search");
121 apiUrl.searchParams.set("query", query);
122 apiUrl.searchParams.set("type", type || "Latest");
123 if (cursor) {
124 apiUrl.searchParams.set("cursor", cursor);
125 }
126
127 const response = await fetch(apiUrl.toString(), {
128 headers: {
129 "Authorization": `Bearer ${apiKey}`,
130 "Accept": "application/json",
131 },
136 try {
137 const errorData = await response.json();
138 errorText = errorData.message || `API Error: ${response.statusText}`;
139 } catch {
140 errorText = `API Error: ${response.statusText}`;
141 }
142 throw new Error(errorText);
167 "Content-Type": "application/json",
168 "Authorization": `Bearer ${supabaseKey}`,
169 "apikey": supabaseKey,
170 "Prefer": "return=minimal",
171 },
344 ctx.waitUntil(incrementSearchCount(authResult.userId, env));
345
346 // Forward request to SocialData API
347 const data = await forwardToSocialData(query, type, cursor, env);
348
450 JSON.stringify({
451 status: "ok",
452 message: "SocialData API Proxy is running",
453 environment: "Cloudflare Workers",
454 }),

ipv4-counterindex.ts2 matches

@maxmUpdated 4 days ago
15await initDatabase();
16
17// API endpoint to get visit data
18app.get("/api/visits", async (c) => {
19 const visits = await getAllVisits();
20 const totalVisits = await getTotalVisits();
226
227 // Add engagement filters
228 // Always use min_ (greater than or equal to) for API filters
229 if (likesCount) {
230 finalQuery += ` min_faves:${likesCount}`;
236
237 // Note: Replies count, bookmark count, and views count might not be directly filterable
238 // in the Twitter/X API. These may need to be filtered client-side after fetching.
239
240 return finalQuery.trim();
272 maxTweets: parseInt(maxTweets),
273 filters: {
274 // These filters will be applied client-side if the API doesn't support them directly
275 // Always use "greater than or equal to" filtering
276 repliesCount: repliesCount
380 // Helper to check if a tweet meets the client-side filter criteria
381 const meetsCriteria = (tweet) => {
382 // Apply any client-side filters here that the API doesn't support
383 // Only perform "greater than or equal to" checks
384
401 }
402
403 // Apply like count filter if not handled by API
404 if (likesCount && tweet.favorite_count !== undefined) {
405 if (tweet.favorite_count < parseInt(likesCount)) return false;
406 }
407
408 // Apply retweet count filter if not handled by API
409 if (retweetsCount && tweet.retweet_count !== undefined) {
410 if (tweet.retweet_count < parseInt(retweetsCount)) return false;

ipv4-counterindex.html1 match

@maxmUpdated 5 days ago
125 document.getElementById('refresh-btn').addEventListener('click', async () => {
126 try {
127 const response = await fetch('/api/visits');
128 const data = await response.json();
129 updateUI(data);

StarterPackFeedsneynar.ts2 matches

@moeUpdated 5 days ago
1const baseUrl = '/neynar-proxy?path='
2// const baseUrl = "https://api.neynar.com/v2/farcaster/";
3
4export async function fetchNeynarGet(path: string) {
8 'Content-Type': 'application/json',
9 'x-neynar-experimental': 'true',
10 'x-api-key': 'NEYNAR_API_DOCS',
11 },
12 })

StarterPackFeedsApp.tsx3 matches

@moeUpdated 5 days ago
60 <div className="">✷ Farcaster mini app manifest + webhook + embed metadata</div>
61 <div className="">✷ Farcaster notifications (storing tokens, sending recurring notifications, ...)</div>
62 <div className="">✷ Neynar API integration for Farcaster data</div>
63 <div className="">✷ Hosted on Val Town (instant deployments on save)</div>
64 <div className="">
74
75// function Database() {
76// const queryFn = () => fetch('/api/counter/get').then((r) => r.json())
77// const { data, refetch } = useQuery({ queryKey: ['counter'], queryFn })
78// return (
80// {/* <h2 className="font-semibold">Database Example</h2> */}
81// <div className="">Counter value: {data}</div>
82// <Button variant="outline" onClick={() => fetch('/api/counter/increment').then(refetch)}>
83// Increment
84// </Button>

StarterPackFeedsneynar.ts4 matches

@moeUpdated 5 days ago
1const NEYNAR_API_KEY = Deno.env.get("NEYNAR_API_KEY") || "NEYNAR_API_DOCS";
2const headers = {
3 "Content-Type": "application/json",
4 "x-api-key": NEYNAR_API_KEY,
5};
6
7export const fetchGet = async (path: string) => {
8 return await fetch("https://api.neynar.com/v2/farcaster/" + path, {
9 method: "GET",
10 headers: headers,
13
14export const fetchPost = async (path: string, body: any) => {
15 return await fetch("https://api.neynar.com/v2/farcaster/" + path, {
16 method: "POST",
17 headers: headers,

vapi-minutes-db1 file match

@henrywilliamsUpdated 1 day ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 1 day 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