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/$%7Burl%7D?q=fetch&page=1187&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 13595 results for "fetch"(2943ms)

insecureFetchmain.tsx3 matches

@vladimyr•Updated 1 year ago
1export function insecureFetch(input: string | URL | Request, init?: RequestInit) {
2 const origReq = new Request(input, init);
3 const proxyURL = new URL("https://unsecure-fetch.val-town.workers.dev");
4 proxyURL.searchParams.set("url", origReq.url);
5 const req = new Request(proxyURL, origReq);
6 return globalThis.fetch(req);
7}

insecureFetchREADME.md5 matches

@vladimyr•Updated 1 year ago
1# Insecure SSL Cert Fetch
2
3This will be useful if you're getting a `invalid peer certificate: UnknownIssuer error`.
4
5If you need to make a fetch request to a website with a dubious or non-standard SSL certificate, you can use this proxy we made on Cloudflare workers (which doesn't verify SSL certs): https://unsecure-fetch.val-town.workers.dev/
6
7```ts
8import { insecureFetch } from "https://esm.town/v/stevekrouse/insecureFetch";
9
10const url = "https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20";
11const data = await insecureFetch(url)
12const text = await data.text();
13console.log(text)
14```
15
16Migrated from folder: a0_forks/insecureFetch

signedFetchmain.tsx5 matches

@vladimyr•Updated 1 year ago
11};
12
13export function createSignedFetch(
14 options: SignatureOptions & {
15 fetch?: typeof fetch;
16 },
17) {
18 const fetch = options.fetch ?? globalThis.fetch;
19 return async function signedFetch(
20 input: Request | URL | string,
21 init?: RequestInit & Partial<SignatureOptions>,
25 ...init,
26 });
27 return fetch(signedReq);
28 };
29}

GistGPTmain.tsx4 matches

@weaverwhale•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { Hono } from "npm:hono";
3import { OpenAI } from "npm:openai";
5const gistGPT = async (input: string, about?: boolean) => {
6 // if about, use the input as the prompt
7 // if not, use the input as a code file URL, and fetch the content
8 const chatInput = about ? input : await (await fetch(input)).text();
9
10 const openai = new OpenAI();
69});
70
71export default app.fetch;

prism_feature_notificationsmain.tsx1 match

@thesephist•Updated 1 year ago
15
16export default async function(interval: Interval) {
17 const response = await fetch(dictionaryUrl);
18 const { features } = await response.json();
19 const featuresAboveConfidenceThreshold = features.filter(

dailyDadJokemain.tsx2 matches

@natekid•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

invoice_detamain.tsx1 match

@pomdtr•Updated 1 year ago
167}
168
169export default router.fetch;
170

extract_contentmain.tsx3 matches

@cotr•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import * as cheerio from "npm:cheerio";
3
7 const url = body.url;
8 if (url) {
9 // Use std/fetch for proxied request
10 const response = await fetch(url);
11 const html = await response.text();
12 const $ = cheerio.load(html);

DownTimemain.tsx2 matches

@sirdrope•Updated 1 year ago
9 let reason: string;
10 try {
11 const res = await fetch(URL, { redirect: "follow" });
12 if (res.status !== 200) {
13 reason = `(status code: ${res.status})`;
15 }
16 } catch (e) {
17 reason = `couldn't fetch: ${e}`;
18 ok = false;
19 }

dailyDadJokemain.tsx2 matches

@tomasholub•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

FetchBasic2 file matches

@ther•Updated 12 hours ago

GithubPRFetcher

@andybak•Updated 3 days ago