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({
2import { TV_SHOWS_WATCHED } from "https://esm.town/v/U9G/TV_SHOWS_WATCHED?v=2";
3let { LAST_TV_HASHES } = await import("https://esm.town/v/U9G/LAST_TV_HASHES?v=1");
4import { fetchJSON } from "https://esm.town/v/U9G/fetchJSON?v=1";
5
6export let TV_SHOW_NEW_EPISODE_NOTIFIER = async () => {
7 const makeReqTo = (url) =>
8 fetchJSON(url, {
9 headers: {
10 "trakt-api-key": "Mock",
1import { fetchTwitterUser } from "https://esm.town/v/andreterron/fetchTwitterUser";
2
3export async function sortedPosts({ accessToken, posts }: {
16 posts.slice(0, 4).map(async (post) => {
17 try {
18 const author = await fetchTwitterUser({
19 id: post.author_id,
20 accessToken,
27 }
28 catch (e) {
29 console.log("Failed to fetch user", post.author_id, q);
30 console.error(e);
31 return undefined;
1import { fetchJSON } from "https://esm.town/v/val/fetchJSON";
2
3export let wee1 = fetchJSON(
4 "https://api.val.town/express/@val.wee2",
5 {
1import { fetchJSON } from "https://esm.town/v/dpetrouk/fetchJSON";
2
3export let untitled_pinkDamselfly = async () => {
4 return await fetchJSON(
5 "https://twitter.com/__drewface/status/1664273547764830208?s=20",
6 );
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let valTownApiExampleSearch = (async () => {
4 const query = new URLSearchParams({ query: "lodash", limit: "4" });
5 const response = await fetch(`https://api.val.town/v1/search/vals?${query}`);
6 const json = await response.json();
7 return json;
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let blocks_inner = async (req, res) => {
4 const [_, user, id, ...file] = req.path.split("/");
5 const gist = await fetch(`https://api.github.com/gists/${id}`).then((r) =>
6 r.json()
7 );
11 res.set("Content-Type", "application/javascript");
12 return res.send(
13 await fetch(gist.files[file.filter(Boolean).join("/")].raw_url).then(
14 (r) => r.text()
15 ),
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let vid = async (name) =>
4 (await fetchJSON(
5 `https://api.val.town/v1/alias/${name.replace(".", "/").replace("@", "")}`,
6 )).id;
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// Returns NASA's Astronomy Picture of the Day (APOD)
4export const nasaAPOD = fetchJSON("cutt.ly/T7ksirK");
5// Forked from @iBrokeit.nasaAPOD
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2
3export async function valTownBlogJSON(): Promise<Blog[]> {
4 let { parse } = await import("npm:node-html-parser");
5 const text = await fetchText("https://blog.val.town");
6 return [
7 ...parse(text)