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/$%7Bsuccess?q=fetch&page=629&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 9263 results for "fetch"(1561ms)

markdown_downloadmain.tsx13 matches

@taras•Updated 7 months ago
145 transcript += arr.map(({ text }) => text).join("\n\n");
146 } catch (e) {
147 transcript = `Failed to fetch transcript ${e}\n`;
148 }
149 let header = "";
153 + y.description + "\n</div>\n\n";
154 } catch (e) {
155 header = `Failed to fetch youtube metadata: ${e}\n`;
156 }
157 return header + "\n" + transcript;
203
204 let html = action.htmlContent;
205 let fetch_response;
206 if (!html) {
207 fetch_response = await fetch(url.toString(), {
208 method: req.method,
209 headers: new Headers({
212 "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
213 "Accept-Language": "en-US,en;q=0.5",
214 "Sec-Fetch-Site": "cross-site",
215 "Sec-Fetch-Mode": "navigate",
216 "Sec-Fetch-User": "?1",
217 "Sec-Fetch-Dest": "document",
218 "Referer": "https://www.google.com/",
219 "sec-ch-ua": `"Not A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"`,
225 });
226
227 console.log(fetch_response);
228
229 html = await fetch_response.text();
230 }
231 let title = "";
243 let markdown_extended = markdown + "\n\n" + url;
244
245 if (fetch_response && Math.floor(fetch_response.status / 200) * 200 != 200 || markdown === "") {
246 const jina_url = `https://r.jina.ai/${url.toString()}`;
247 console.log(`jina fallback:${jina_url}`);
248 const fallback_fetch_response = await fetch(jina_url);
249 markdown_extended = await fallback_fetch_response.text();
250 }
251 if (req.headers.get("Accept")?.includes("text/html")) {

sqlite_adminmain.tsx1 match

@notclaytn•Updated 7 months ago
10app.get("/", async (c) => c.html(await sqlite_admin_tables()));
11app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
12export default basicAuth(app.fetch, { verifyUser: (_, password) => verifyToken(password) });

wakatime-readme-chartmain.tsx4 matches

@loading•Updated 7 months ago
68
69 useEffect(() => {
70 fetch("/chart")
71 .then(response => response.text())
72 .then(setChartUrl)
89}
90
91async function fetchWakaTimeData(): Promise<DataPoint[]> {
92 const response = await fetch("https://wakatime.com/share/@load1n9/899abefd-d814-4e99-b603-e94af0305d4a.json");
93 const data = await response.json();
94 return data.data.map((item: any) => ({
155 if (url.pathname === "/chart") {
156 try {
157 const data = await fetchWakaTimeData();
158 const chartBuffer = await generateChart(data);
159 return new Response(chartBuffer, {

translatemain.tsx3 matches

@yieldray•Updated 7 months ago
3export async function translate(req: Request) {
4 if (req.method === "POST") {
5 const { code: status, data } = await fetch("https://deepl.deno.dev/translate", {
6 method: "POST",
7 body: req.body,
35 <script type="module">
36 import { html, Component, render } from "https://cdn.cbd.int/htm/preact/standalone.module.js";
37 import { ofetch } from "https://esm.sh/ofetch/dist/index.mjs";
38 import { z } from "https://esm.sh/zod";
39 // https://github.com/developit/htm
132 target_lang: z.string().default("zh"),
133 });
134 const data = await ofetch("/", {
135 method: "POST",
136 body: Options.parse({

cronmain.tsx4 matches

@with_heart•Updated 7 months ago
24}
25
26async function fetchAndProcessData() {
27 const response = await fetch(
28 'https://api.npmjs.org/versions/xstate/last-week',
29 )
145
146 if (await isTableEmpty()) {
147 await fetchAndProcessData()
148 }
149
157export default async function cron(interval: Interval,): Promise<void> {
158 await ensureTableExists()
159 await fetchAndProcessData()
160}
161

selfDestructmain.tsx2 matches

@codemore•Updated 7 months ago
1import ValTown from "https://esm.sh/@valtown/sdk@0.22.0";
2import { fetchValInfo } from "https://esm.town/v/pomdtr/fetchValInfo?v=2";
3
4export async function selfDestruct(importMetaUrl: string) {
5 const { id } = await fetchValInfo(importMetaUrl);
6 const { vals } = new ValTown();
7

Kinopio_Get_User_Spacesmain.tsx1 match

@pketh•Updated 7 months ago
18const getSpaces = async () => {
19 const options = requestOptions({ method: "GET" });
20 const response = await fetch(`${apiHost}/user/spaces`, options);
21 const data = await response.json();
22 const spaceNames = data.map(space => space.name);

lastloginmain.tsx1 match

@olifrah•Updated 7 months ago
10 useEffect(() => {
11 const checkAuth = async () => {
12 const response = await fetch('/auth/check');
13 const data = await response.json();
14 setEmail(data.email);

strivingSilverTapirmain.tsx2 matches

@dcm31•Updated 7 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramGetMe = async (botToken: string) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/getMe`,
6 );

telegramGetMemain.tsx2 matches

@dcm31•Updated 7 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramGetMe = async (botToken: string) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/getMe`,
6 );

proxyFetch2 file matches

@vidar•Updated 1 day ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 2 days ago