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=788&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 8150 results for "fetch"(2630ms)

getTopicsmain.tsx2 matches

@nic•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const getTopics = async () => {
4 const topics = fetchJSON(
5 "https://bldgforum.com/?index=&_data=routes%2F__home%2Findex"
6 );

fetchRssmain.tsx4 matches

@pdebie•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// This supports more RSS types than @stevekrouse.fetchRSS
4export async function fetchRss(url: string, lastRunDate?: string | number) {
5 let Parser = await import("npm:rss-parser");
6 let parser = new Parser.default();
7 let response = await fetch(url);
8 let data = await response.text();
9 let { items } = await parser.parseString(data);

proxyFetch4main.tsx5 matches

@alp•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const proxyFetch4 = async (req, res) => {
4 const { url, options } = req.body;
5 try {
6 const response = await fetch(url, options);
7 return res.status(response.status).send(await response.text());
8 } catch (e) {
9 const errorMessage = e instanceof Error ? e.message : "Unknown error";
10 console.error("Failed to initiate fetch", e);
11 return res.status(500).send(`Failed to initiate fetch: ${errorMessage}`);
12 }
13};

bebopBotWebhookmain.tsx2 matches

@z233•Updated 1 year ago
1import { feishuGetInteractiveMessage } from "https://esm.town/v/z233/feishuGetInteractiveMessage";
2import { bebopBotFeishuWebhookUrl } from "https://esm.town/v/z233/bebopBotFeishuWebhookUrl";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
4import { createFeishuCardActionElementBuilder } from "https://esm.town/v/z233/createFeishuCardActionElementBuilder";
5import { createFeishuCardBuilder } from "https://esm.town/v/z233/createFeishuCardBuilder";
77 }
78 const card = cardBuilder.build();
79 await fetchJSON(
80 bebopBotFeishuWebhookUrl,
81 {

peelSessionArtistSessionmain.tsx2 matches

@aeaton•Updated 1 year ago
1import { fetchHtmlDom } from "https://esm.town/v/aeaton/fetchHtmlDom";
2
3export async function peelSessionArtistSession(url) {
4 const dom = await fetchHtmlDom(url);
5 const headings = dom.querySelectorAll("h3");
6 const trackItems = [...headings].find((heading) =>

extractWikipediaMainTextmain.tsx7 matches

@fab1an•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const extractWikipediaMainText = async () => {
7 const extractWikipediaContent = async (url) => {
8 try {
9 const response = await fetch(url);
10 const html = await response.text();
11 const parser = new DOMParser();
20 return `${textContent.trim()}`;
21 } catch (error) {
22 console.log("Error fetching Wikipedia content:", error);
23 return `An error occurred while fetching the Wikipedia content. ${error}`;
24 }
25 };
27 const randomWikiURL = "https://en.wikipedia.org/wiki/Special:Random";
28 try {
29 const response = await fetch(randomWikiURL, { redirect: "manual" });
30 const location = response.headers.get("location");
31 return location;
32 } catch (error) {
33 console.log("Error fetching random Wikipedia URL:", error);
34 return `An error occurred while fetching the random Wikipedia URL. ${error}`;
35 }
36 };

getRandomArticleInCategorymain.tsx5 matches

@fab1an•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const getRandomArticleInCategory = async (category) => {
13 const listUrl =
14 `https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:${encodedCategory}&cmlimit=500&format=json&origin=*`;
15 const listResponse = await fetch(listUrl);
16 const listData = await listResponse.json();
17 if (!listData.query.categorymembers.length) {
28 encodeURIComponent(randomArticle)
29 }&format=json&utf8=1&origin=*`;
30 const contentResponse = await fetch(contentUrl);
31 const contentData = await contentResponse.json();
32 const pageId = Object.keys(contentData.query.pages)[0];
38 }
39 catch (error) {
40 console.log("Error fetching Wikipedia content:", error);
41 return `An error occurred while fetching the Wikipedia content. ${error}`;
42 }
43};

mathFactmain.tsx2 matches

@dosirak•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3// Random math fact
4export let mathFact = fetchText(
5 "http://numbersapi.com/random/math"
6);

goodReadsmain.tsx2 matches

@dfl•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let goodReads = (url) => {
4 const resp = await fetch(url);
5
6 console.log("url: ", url, resp);

githubGistsmain.tsx2 matches

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

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago