1# GitHub Activity Summarizer
2
3This val.town script fetches a user's recent GitHub activity and generates a summarized narrative overview using OpenAI's GPT model.
4
5## Features
10
11 useEffect(() => {
12 fetchData();
13 }, []);
14
15 const fetchData = async () => {
16 try {
17 const response = await fetch("/api/imf-data");
18 if (!response.ok) {
19 throw new Error("¡Uy, no se pudo traer los datos, che!");
104 }
105
106 const { fetch } = await import("https://esm.town/v/std/fetch");
107
108 // If no valid cache, fetch and process the data
109 const imfResponse = await fetch("https://www.imf.org/external/np/fin/tad/balmov2.aspx?tsvflag=Y&type=TOTAL", {});
110 const arrayBuffer = await imfResponse.arrayBuffer();
111
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
21 const url = new URL(`${this.baseURL}/twitter/search`);
22 url.searchParams.set("query", query);
23 const resp = await fetch(url, {
24 headers: {
25 Authorization: `Bearer ${this.bearerToken}`,
101});
102
103export default app.fetch;
21 const url = new URL(`${this.baseURL}/twitter/search`);
22 url.searchParams.set("query", query);
23 const resp = await fetch(url, {
24 headers: {
25 Authorization: `Bearer ${this.bearerToken}`,
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS