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}
1import { fetchXML } from "https://esm.town/v/stevekrouse/fetchXML?v=3";
2
3export const bggTest = async function () {
4 const xml = await fetchXML(
5 "https://boardgamegeek.com/xmlapi2/plays?username=acciopatronus",
6 );
1import { fetch } from "https://esm.town/v/std/fetch";
2import { insertDataIntoDuckDb } from "https://esm.town/v/neverstew/insertDataIntoDuckDb";
3import { getDuckDB } from "https://esm.town/v/tmcw/getDuckDB?v=1";
5export const duckDbJson = (async () => {
6 const db = await getDuckDB();
7 const r = await fetch("https://jsonplaceholder.typicode.com/todos");
8 await insertDataIntoDuckDb(db, await r.json());
9 const c = await db.connect();
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function raw(val: `@${string}.${string}`) {
4 const [owner, name] = val.slice(1).split(".") as string[];
5 return fetchJSON(
6 `https://api.val.town/v1/alias/${owner}/${name}`,
7 )
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function run(
10 const method = data ? "POST" : "GET";
11 const body = data ? JSON.stringify({ args: data }) : undefined;
12 const response = await fetch(url, { method, headers, body });
13 return await response.json();
14}
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github profile
4export let githubUser = fetchJSON(
5 "https://api.github.com/users/stevekrouse"
6);
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
18 console.log("code: ", code);
19 try {
20 const gh_res = await fetch(
21 `https://github.com/login/oauth/access_token?code=${code}&client_id=${process.env.sanguineGithubClientId}&client_secret=${process.env.sanguineGithubClientSecret}`,
22 {
31 },
32 );
33 console.log("made it past fetch");
34 console.log("gh_res: ", gh_res);
35 if (!gh_res.ok) {
36 throw new Error(`Failed to fetch`);
37 }
38 const gh_res_json = await gh_res.json();
42 const accessToken = data?.access_token;
43 console.log("access_token: ", data);
44 // // Fetch user information using the access token
45 const userResponse: any = await fetch("https://api.github.com/user", {
46 headers: {
47 "Authorization": `Bearer ${accessToken}`,
55 }
56 catch (err) {
57 console.error("Error fetching access token or user data:", err);
58 res.status(500).send("Authentication failed");
59 }