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=778&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 8148 results for "fetch"(1850ms)

githubUsermain.tsx2 matches

@mbforbes•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github profile
4export let githubUser = fetchJSON(
5 "https://api.github.com/users/mbforbes"
6);

dlockmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { searchParams } from "https://esm.town/v/stevekrouse/searchParams";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { parentReference } from "https://esm.town/v/stevekrouse/parentReference";
4
18 ttl = ttl ?? 3; // seconds
19 let method = release ? "release" : "acquire";
20 return fetchJSON(
21 `https://dlock.univalent.net/lock/${id}/${method}?${
22 searchParams({ ttl, lease })

evalPost2main.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let evalPost2 = fetchJSON(
4 "https://api.val.town/v1/eval",
5 {

hnPostsBymain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2import { HNcache } from "https://esm.town/v/stevekrouse/HNcache";
3import { hnPostIdsBy } from "https://esm.town/v/akkartik/hnPostIdsBy?v=3";
6 let postIds = await hnPostIdsBy(user);
7 return postIds.slice(0, 10).map(async (id) => {
8 HNcache[id] = await fetchJSON(
9 `https://hacker-news.firebaseio.com/v0/item/${id}.json`
10 );

allDateMeDocsLengthmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2import { dateMeProfiles } from "https://esm.town/v/stevekrouse/dateMeProfiles";
3
4// can only do first 100 because Val Town only allows 100 fetches per run
5export let allDateMeDocsLength =
6 (await Promise.all(
7 dateMeProfiles.slice(0, 100).map((p) =>
8 p.Profile?.at(0)?.href &&
9 fetchText(p.Profile[0].href).catch((e) => void 0)
10 ),
11 )).join("").length;

elysiamain.tsx1 match

@parweb•Updated 1 year ago
4 const app = new Elysia()
5 .get("/", () => items).post("/", () => items.push(Math.random()));
6 return app.fetch(req);
7};

pageIncludesmain.tsx2 matches

@glen•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let pageIncludes = async function (url, str) {
4 const f = await fetch(url);
5 const t = await f.text();
6 return t.includes(str);

reddit_matchesmain.tsx11 matches

@bnorick•Updated 1 year ago
6 filters,
7 current_state,
8 fetch_limit,
9 enable_toggle,
10 force,
15
16 // TODO: handle >10 subreddits by raising and exception?
17 let fetch_budget = Math.floor(fetch_limit / Object.keys(filters).length);
18 let additional_fetches_required = {};
19 let fetch_total = 0;
20
21 for (const subreddit in filters) {
44 filters: subreddit_filters,
45 after_utc: last_run_at_utc,
46 fetch_limit: fetch_budget,
47 });
48
49 fetch_total += result.fetches;
50
51 if (result.next_fetch_from) {
52 additional_fetches_required[subreddit] = result.next_fetch_from;
53 }
54
55 let extra_message = additional_fetches_required[subreddit]
56 ? `, reached fetch limit (${fetch_budget}), loading more posts after other subreddits if possible`
57 : "";
58 console.log(`processed ${result.new_posts} posts${extra_message}`);
66 }
67
68 // TODO: handle additional_fetches_required
69
70 let text = [];

discordWebhookmain.tsx2 matches

@Kinasha•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export const discordWebhook = async ({ url, content }: {
5 content: string;
6}) => {
7 const text = await fetchText(url, {
8 method: "POST",
9 headers: {

getURLMetadatamain.tsx2 matches

@chase•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let getURLMetadata = async (url) => {
4 const response = await fetch(url);
5 const webpage = await response.text();
6 // Maybe this will work when val.town switches to Deno :-)

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago