1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let currency = async (base = "eur", desired, amount = 1) => {
4 let { rates } = await fetchJSON(
5 "https://open.er-api.com/v6/latest/eur"
6 );
8 return amount * rates[desired.toUpperCase()];
9 else {
10 let { rates } = await fetchJSON(
11 "https://api.coingecko.com/api/v3/exchange_rates"
12 );
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export const webscrapeMinhaBibliotecaCatolicaBoxList = (async () => {
5 "https://assine.bibliotecacatolica.com.br/edicoes-anteriores";
6 const { default: cheerio } = await import("npm:cheerio");
7 const html = await fetchText(sourceUrl);
8 console.log(cheerio);
9 const $ = cheerio.load(html);
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let fetchWithJSON = async <T = any>(url: string, options?: any): Promise<T> => {
4 try {
5 let response = await fetch(url, {
6 ...options,
7 headers: {
12 return await response.json();
13 } catch (error) {
14 throw new Error(`${error.message} in fetch ${url}."`);
15 }
16};
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({
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let stableDiffusionGet = async (key, url) => {
6 "Content-Type": "application/json",
7 };
8 const res = await fetch(url, { headers });
9 return res.json();
10}
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const getFatCatListings = async () => {
4 const meResult = await fetch(
5 "https://api-mainnet.magiceden.dev/v2/collections/degenfatcats/listings?offset=0&limit=20",
6 {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github following
4export let githubFollowing = fetchJSON(
5 "https://api.github.com/users/stevekrouse/following"
6);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github following
4export let githubFollowing = fetchJSON(
5 "https://api.github.com/users/stevekrouse/following"
6);
1import { fetch } from "https://esm.town/v/std/fetch";
2import { email } from "https://esm.town/v/std/email?v=9";
3import { set } from "https://esm.town/v/std/set?v=11";
24 for (let i = 0; i < idArray.length; i++) {
25 const id = idArray[i];
26 const request = fetch(
27 `https://api.live.bilibili.com/room/v1/Room/room_init?id=${id}`,
28 ).then((data) => data.json());
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function wttrJson(location: string) {
4 // https://github.com/chubin/wttr.in#json-output
5 return (await fetch(`https://wttr.in/${location}?format=j1`)).json();
6}