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/$%7Bart_info.art.src%7D?q=fetch&page=731&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 8272 results for "fetch"(2682ms)

valtownAPIExamplesmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let valtownAPIExamples = [
4 "https://api.val.town/v1/alias/stevekrouse",
5 "https://api.val.town/v1/users/a0bf3b31-15a5-4d5c-880e-4b1e22c9bc18",
6 "https://api.val.town/v1/alias/stevekrouse/fetchJSON",
7 "https://api.val.town/v1/vals/18b54b4e-779a-4c56-8ee6-4c75af7e55f0",
8].map(fetchJSON);

getMessagesmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { discordBotToken } from "https://esm.town/v/stevekrouse/discordBotToken";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export let getMessages = (channelId) => fetchJSON(
5 `https://discord.com/api/channels/${channelId}/messages`, {
6 headers: {

safeCountermain.tsx1 match

@stevekrouse•Updated 1 year ago
19 // Note 1: If I referenced @stevekrouse.threadsafeStateEx here
20 // it would return the value of that val at the beginning of this function,
21 // before I acquired the lock. I fetch it's value now to get the most up-to-date
22 // value of it, now that I know it can't be updated until I release this lock.
23 //

runAgentmain.tsx2 matches

@jacoblee93•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
50 "Extracts information about the pull requests merged as part of a LangChain release. Takes a GitHub URL as input.",
51 func: async (input, runManager) => {
52 const response = await fetch(input.trim());
53 const pageContent = await response.text();
54 const $ = cheerio.load(pageContent);

postsmain.tsx2 matches

@jorrdang•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const posts = async () => {
4 const data = await fetch("https://jsonplaceholder.typicode.com/posts");
5
6 return data;

fetchJSONmain.tsx4 matches

@joey•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL?v=3";
3
4export const fetchJSON = async (url: string, options?: any) => {
5 let f = await fetch(normalizeURL(url), {
6 redirect: "follow",
7 ...options,
16 return JSON.parse(t);
17 } catch (e) {
18 throw new Error(`fetchJSON error: ${e.message} in ${url}\n\n"${t}"`);
19 }
20};

stopDeparturesmain.tsx2 matches

@kognise•Updated 1 year ago
1import { set } from "https://esm.town/v/std/set?v=11";
2import process from "node:process";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
4import { transitCacheExpiry } from "https://esm.town/v/kognise/transitCacheExpiry";
5import { stopDeparturesCache } from "https://esm.town/v/kognise/stopDeparturesCache";
14 encodeURIComponent(globalStopId)
15 }`;
16 const json = await fetchJSON(url, {
17 headers: {
18 apiKey: process.env.transit,

githubUsermain.tsx2 matches

@hkg•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/stevekrouse"
6);

textToImageDallemain.tsx2 matches

@hootz•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const textToImageDalle = async (
12 url: string;
13 }[];
14 } = await fetchJSON(
15 "https://api.openai.com/v1/images/generations",
16 {

fetchWikipediaContentmain.tsx4 matches

@fab1an•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchWikipediaContent(url) {
4 try {
5 const title = url.split("/wiki/")[1];
6 const apiUrl = `https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exintro&explaintext&format=json&origin=*&titles=${title}`;
7 const response = await fetch(apiUrl);
8 const data = await response.json();
9 const pageId = Object.keys(data.query.pages)[0];
11 return content;
12 } catch (error) {
13 console.error(`Error fetching Wikipedia content: ${error.message}`);
14 return "";
15 }

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago