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=763&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 8124 results for "fetch"(2304ms)

redditMatchesmain.tsx3 matches

@bnorick•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let redditMatches = async ({ username, filters, current_state, options }) => {
23 let params = last ? `?before=${last}` : "";
24 let subreddit_matches = [];
25 let data = await fetchJSON(
26 `https://www.reddit.com/r/${subreddit}/new/.json${params}`
27 );
73
74 last = data.data.children[0].data.name;
75 data = await fetchJSON(
76 `https://www.reddit.com/r/${subreddit}/new/.json?before=${last}`
77 );

tacUrlToBibtexmain.tsx2 matches

@paolobrasolin•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export const tacUrlToBibtex = async (url: string) => {
4 const cheerio = await import("npm:cheerio");
5 const html = await fetchText(url);
6 const $ = cheerio.load(html);
7 const title = $("h1").text().trim().replace(/\s+/g, " ");

getLemmyPostsmain.tsx2 matches

@pdebie•Updated 1 year ago
1// This tries to fetch a specific post on multiple Lemmpy instances
2// and can try to fix missing comments on a specific instance.
3export async function getLemmyPosts(instance: string, communityName: string) {
4 const { LemmyHttp } = await import("npm:lemmy-js-client");
5 let client = new LemmyHttp(`https://${instance}`, {
6 fetchFunction: fetch,
7 });
8 const { posts } = await client.getPosts({

denoGameHTMLmain.tsx3 matches

@rodrigotello•Updated 1 year ago
121 "https://api.val.town/v1/run/rodrigotello.updateDinoScoreboard";
122
123 fetch(apiUrl, {
124 method: "POST",
125 headers: {
139 .then((result) => {
140 console.log("Scoreboard updated:", result);
141 // Update the scoreboard variable with the fetched data
142 scoreboard = result;
143 })
157 text("Press SPACE to play again", width / 2, height / 2 + 10);
158
159 // Fetch the latest scoreboard data
160 const apiUrl =
161 "https://api.val.town/v1/run/rodrigotello.dinoGameScoreboard";

peelSessionLettersmain.tsx2 matches

@aeaton•Updated 1 year ago
1import { fetchHtmlDom } from "https://esm.town/v/aeaton/fetchHtmlDom";
2
3export async function peelSessionLetters() {
4 const url = `https://www.bbc.co.uk/radio1/johnpeel/artists/`;
5 const dom = await fetchHtmlDom(url);
6 const items = dom.querySelectorAll(
7 "#alphabetical-sub-section-navigation > ul > li > a",

aqimain.tsx2 matches

@ian•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let aqi = async () => {
4 let pm25 = (
5 await fetchJSON(
6 "https://api.openaq.org/v2/latest?" +
7 new URLSearchParams({

telegramSendMessagemain.tsx2 matches

@vtdocs•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramSendMessage = async (botToken: string, options: {
14 reply_markup?: any[];
15}) =>
16 fetchJSON(
17 `https://api.telegram.org/bot${botToken}/sendMessage`,
18 {

getGithubStarsmain.tsx3 matches

@vtdocs•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const getGithubStars = async (username: string) => {
4 const user = await fetchJSON(
5 `https://api.github.com/users/${username}`,
6 );
10 while (pages--) {
11 for (
12 const repo of await fetchJSON(
13 `https://api.github.com/users/${username}/repos?per_page=100&page=${
14 pages + 1

fetchestoomuchmain.tsx1 match

@bitbloxhub•Updated 1 year ago
1import { hnTopStory } from "https://esm.town/v/stevekrouse/hnTopStory?v=3";
2
3export let fetchestoomuch = async () => {
4 await Promise.all(async (): Array<Promise<string>> => {
5 return Array(20).fill().map(hnTopStory());

untitled_coffeeElkmain.tsx6 matches

@WilcoAJ•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const untitled_coffeeElk = (async () => {
7 return `https://repository.overheid.nl/sru?query=dt.title="exploitatievergunning horecabedrijf" AND dt.title="Besluit (Nieuw)" AND dt.title="Nieuw" AND dt.creator=Amsterdam AND dt.modified=${dateString}&maximumRecords=100`;
8 }
9 async function doFetch(date: Date): any {
10 const url = makeUrl(date);
11 const fetchResponse = await fetch(url.toString());
12 const text = await fetchResponse.text();
13 if (!fetchResponse.ok) {
14 throw new Error(text);
15 }
53 });
54 }
55 const resp = await doFetch(new Date("2023-08-31"));
56 const data = parseResponse(resp);
57 return data;

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago