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=66&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 12456 results for "api"(1004ms)

weatherindex.ts4 matches

@anand_gUpdated 6 days ago
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
13
14app.get("/api/weather", c => {
15 return c.text("Hello World!");
16});
17
18app.get("/api/geocode", c => {
19 return c.text("Hello World!");
20});
21
22// Add your API routes here
23// app.get("/api/data", c => c.json({ hello: "world" }));
24
25// Unwrap and rethrow Hono errors as the original error
34 async () => {
35 const token = Deno.env.get("DISCORD_BOT_TOKEN");
36 const roleResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/roles`, {
37 headers: {
38 Authorization: `Bot ${token}`,
55 async () => {
56 const token = Deno.env.get("DISCORD_BOT_TOKEN");
57 const memberResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/members/${userId}`, {
58 headers: {
59 Authorization: `Bot ${token}`,
79 const token = Deno.env.get("DISCORD_BOT_TOKEN");
80 const toggleResponse = await fetch(
81 `https://discord.com/api/v10/guilds/${guildId}/members/${userId}/roles/${roleId}`,
82 {
83 method,
138 }
139 } catch (e) {
140 // Cache miss, continue with API call
141 }
142
162 "fetchGuildRolesForAlerts",
163 async () => {
164 const roleResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/roles`, {
165 headers: {
166 Authorization: `Bot ${token}`,
26
27 // First, get the member to check if they have any of the server helper roles
28 const memberResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/members/${userId}`, {
29 headers: {
30 Authorization: `Bot ${token}`,
50
51 // Get the role information to include in the response
52 const roleResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/roles`, {
53 headers: {
54 Authorization: `Bot ${token}`,
72
73 const toggleResponse = await fetch(
74 `https://discord.com/api/v10/guilds/${guildId}/members/${userId}/roles/${SERVER_HELPER_PINGS_ROLE_ID}`,
75 {
76 method,
22
23 // Get guild information to check for owner
24 const guildResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}`, {
25 headers: {
26 Authorization: `Bot ${token}`,
36
37 // Get member to check for administrator permissions
38 const memberResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/members/${userId}`, {
39 headers: {
40 Authorization: `Bot ${token}`,
49
50 // Fetch all roles in the guild
51 const rolesResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/roles`, {
52 headers: {
53 Authorization: `Bot ${token}`,
122 const token = Deno.env.get("DISCORD_BOT_TOKEN");
123 // First, get the role information to include in the response
124 const roleResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/roles`, {
125 headers: {
126 Authorization: `Bot ${token}`,
135
136 // Get the member to check if they have the role
137 const memberResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/members/${userId}`, {
138 headers: {
139 Authorization: `Bot ${token}`,
150 const action = hasRole ? "removed" : "added";
151 const toggleResponse = await fetch(
152 `https://discord.com/api/v10/guilds/${guildId}/members/${userId}/roles/${roleId}`,
153 {
154 method,
207 }
208
209 // Use the error handling wrapper for the API call
210 const allRoles = await withErrorHandling(
211 "fetchGuildRoles",
212 async () => {
213 const token = Deno.env.get("DISCORD_BOT_TOKEN");
214 const roleResponse = await fetch(`https://discord.com/api/v10/guilds/${guildId}/roles`, {
215 headers: {
216 Authorization: `Bot ${token}`,

slacktest.ts3 matches

@dinavinterUpdated 6 days ago
21
22// As of 2025/02, you cannot enble Agents & Assistants correctly with manifest.json
23// A workaround is to set the app up using https://api.slack.com/apps website.
24
25// app.assistant(
39
40// -------------------------------
41// Events API
42// -------------------------------
43
214// -------------------------------
215// Custom Functions
216// https://api.slack.com/automation/functions/custom
217// -------------------------------
218

untitled-3323new-file-8432.tsx5 matches

@AP123Updated 6 days ago
17 }
18
19 // single-post regex handles www, old, api, or naked reddit.com
20 if (/^https?:\/\/(?:[^/]+\.)?reddit\.com\/.*\/comments\/[a-z0-9]+/i.test(feedUrl)) {
21 try {
65 const pathname = new URL(postUrl).pathname.replace(/\/$/, "");
66 const headers = {
67 // UA beginning with “Reddit/” is whitelisted for api.reddit.com JSON
68 "User-Agent": "Reddit/20230522 (Android 14; Pixel 8 Pro)",
69 "Accept": "application/json",
70 };
71
72 // 1️⃣ try api.reddit.com (no Cloudflare)
73 let txt = await fetch(`https://api.reddit.com${pathname}?limit=${limit}&raw_json=1`, { headers })
74 .then(r => r.text());
75 if (txt.trim().startsWith("<")) { // got HTML ➜ fallback
79 }).then(r => r.text());
80 if (txt.trim().startsWith("<"))
81 throw new Error("Both api.reddit.com and old.reddit.com returned HTML (likely blocked)");
82 }
83

rdo-dailies-webhookmain.ts1 match

@mmoriharaUpdated 6 days ago
83
84async function fetchDailies() {
85 const response = await fetch("https://api.rdo.gg/challenges/index.json");
86 return response.json();
87}

rdo-dailies-webhookdata.json1 match

@mmoriharaUpdated 6 days ago
20 "mpgc_bulls_skinned": "Bulls skinned",
21 "mpgc_burdock_root_picked": "Burdock Roots picked",
22 "mpgc_capitale_notes_collected": "Capitale notes collected",
23 "mpgc_chanterelle_picked": "Chanterelle picked",
24 "mpgc_chickens_skinned": "Chickens skinned",

musicalHarlequinRatmain.tsx2 matches

@armadillomikeUpdated 6 days ago
279 <title>The S.M.A.R.T Hive</title>
280 <meta name="viewport" content="width=device-width, initial-scale=1">
281 <link rel="preconnect" href="https://fonts.googleapis.com">
282 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
283 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
284 <script src="https://esm.town/v/std/catch"></script>
285 </head>

delightfulJadeAnacondamain.tsx2 matches

@armadillomikeUpdated 6 days ago
279 <title>The S.M.A.R.T Hive - Purchase</title>
280 <meta name="viewport" content="width=device-width, initial-scale=1">
281 <link rel="preconnect" href="https://fonts.googleapis.com">
282 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
283 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
284 <script src="https://esm.town/v/std/catch"></script>
285 </head>

vapi-minutes-db2 file matches

@henrywilliamsUpdated 5 hours ago

social_data_api_project3 file matches

@tsuchi_yaUpdated 3 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