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=751&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 8146 results for "fetch"(2425ms)

GetPelotonWorkoutsmain.tsx3 matches

@steveb1313•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
6 res: express.Response,
7) {
8 let response = await fetch("https://api.onepeloton.com/auth/login", {
9 method: "POST",
10 mode: "no-cors",
20 });
21 const session = await response.json();
22 let workoutResponse = await fetch(
23 `https://api.onepeloton.com/api/user/${session["user_id"]}/workouts`,
24 {

boredActivitiesmain.tsx2 matches

@roniemeque•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Activity suggestions for when you're bored
4export let boredActivities = fetchJSON(
5 "https://www.boredapi.com/api/activity",
6);

getWeatherGovDatamain.tsx3 matches

@wilt•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Currently broken! Val.Town cannot fetch from .gov sites
4// You can get these input values by calling https://api.weather.gov/points/{latitude},{longitude}
5export async function getWeatherGovData({ office, gridX, gridY }) {
6 const data = await fetchJSON(
7 `https://api.weather.gov/gridpoints/${office}/${gridX},${gridY}/forecast`
8 );

valTownApiExampleUsermain.tsx2 matches

@tmcw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let valTownApiExampleUser = (async () => {
4 const handle = "tmcw";
5 const response = await fetch(`https://api.val.town/v1/alias/${handle}`);
6 const json = await response.json();
7 return json;

githubStarredmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// Cities named Brooklyn
4export let githubStarred = fetchJSON(
5 "https://api.github.com/users/stevekrouse/starred",
6);

openAqNowcastAQImain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { nowcastPMAqi } from "https://esm.town/v/stevekrouse/nowcastPMAqi";
2import { msHour } from "https://esm.town/v/stevekrouse/msHour";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
4
5export async function openAqNowcastAQI({ location_id }) {
6 const { results } = await fetchJSON(
7 "https://api.openaq.org/v2/measurements?" +
8 new URLSearchParams({

exampleBirdmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchABird } from "https://esm.town/v/crsven/fetchABird?v=1";
2
3export let exampleBird = fetchABird();

fetchHTMLmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1import { parseHTML } from "https://esm.town/v/stevekrouse/parseHTML";
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
3
4// this function doesn't work yet, I'm still iterating on it
5export function fetchHTML(url: string, options?: any) {
6 return fetchText(url, options)
7 .then(parseHTML);
8}

holidaysUSmain.tsx2 matches

@paperee•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Public holidays in the US in 2023
4export let holidaysUS = fetchJSON(
5 "https://bed.paperee.repl.co/detail"
6);

hnTopTenStoriesmain.tsx4 matches

@iakovos•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4// Get the title of the top story on Hacker News
5export async function hnTopTenStories() {
6 const topStories: Number[] = await fetch(
7 "https://hacker-news.firebaseio.com/v0/beststories.json?print=pretty",
8 ).then((res) => res.json());
9 const top10Stories = await Promise.all(
10 topStories.slice(0, 10).map(async (id) => {
11 return await fetchJSON(
12 `https://hacker-news.firebaseio.com/v0/item/${id}.json`,
13 );

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago