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/image-url.jpg?q=fetch&page=772&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 8357 results for "fetch"(1547ms)

getInformationOfTheGitHubReposirotymain.tsx2 matches

@tzq•Updated 1 year ago
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/dvergin/fetchJSON?v=2";
3
4export async function getInformationOfTheGitHubReposiroty(repository) {
5 return await fetchJSON(`https://api.github.com/repos/${repository}`, {
6 headers: {
7 Accept: "application/vnd.github+json",

coolHnPostsmain.tsx2 matches

@VictorForissier•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function coolHnPosts(id) {
4 return fetch("https://hn.algolia.com/api/v1/search_by_date?tags=author_" + id)
5 .then((res) => res.json())
6 .then((res) => res.hits[0].comment_text);

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}

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago