3I wanted to log this data so I can analyse which days do I game the most ? which periods do I log the most hours in my confort game (Dead By Daylight) ? And so on. I think the data viz possibilities are super interesting, just like when Valve releases the "Steam in review" at the end of the year
45This val fetches your recent playtime history from valve's API and stores it in a database every day !
67The project uses multiple vals to work:
weatherGPTmain.tsx1 match
4let location = "toronto on";
5let lang = "en";
6const weather = await fetch(
7`https://wttr.in/${location}?lang=${lang}&format=j1`,
8).then(r => r.json());
blob_adminmain.tsx2 matches
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
23import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
133});
134135export default modifyFetchHandler(passwordAuth(app.fetch));
303132export default app.fetch;
7import { ObjectInspector } from "https://esm.sh/react-inspector";
89async function fetchGgufMetadata(url: string) {
10const { metadata, tensorInfos } = await gguf(url);
11return { metadata, tensorInfos };
1a super simple JSON setter/getter using valtown blobs. use GET to fetch it, use POST to set it. expects the inbound data to be JSON for simplicity. use `?key=foobar` to specify different storage locations.
23set:
tinygoHttpExamplemain.tsx1 match
1import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
2const resp = await fetch("https://maxm-wasmblobhost.web.val.run/ihml3eg6qee7q2navnnpjqysogqvzdy7.wasm");
34export const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
Title_Extractormain.tsx10 matches
1import cheerio from "https://esm.sh/cheerio@1.0.0-rc.10";
2import { fetch } from "https://esm.town/v/std/fetch";
34// Helper function to retrieve CSRF token if needed
5async function getCsrfToken(url, cookies) {
6try {
7console.log("Fetching CSRF Token from URL:", url);
8console.log("Using Cookies:", cookies);
9const response = await fetch(url, {
10headers: {
11"User-Agent":
24}
25const html = await response.text();
26console.log("Fetched HTML (CSRF Token Request):", html);
2728const $ = cheerio.load(html);
31return csrfToken || "";
32} catch (error) {
33console.error("Error fetching CSRF token:", error);
34return "";
35}
36}
3738// Function to fetch HTML content and extract titles
39async function titleExtractor(url, cookies, csrfToken) {
40try {
41console.log("Fetching URL:", url);
42console.log("Using CSRF Token:", csrfToken);
43const encodedUrl = encodeURI(url);
45await new Promise(resolve => setTimeout(resolve, Math.floor(Math.random() * 1000) + 500));
4647const response = await fetch(encodedUrl, {
48headers: {
49"User-Agent":
63}
64const html = await response.text();
65console.log("Fetched HTML:", html);
6667const $ = cheerio.load(html);
72return titles;
73} catch (error) {
74console.error("Error fetching or parsing HTML:", error);
75return [];
76}
1import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
2const resp = await fetch("https://maxm-wasmblobhost.web.val.run/ihml3eg6qee7q2navnnpjqysogqvzdy7.wasm");
34export const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
1617import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
18const resp = await fetch("https://maxm-wasmblobhost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
19const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
20export default async function(req: Request): Promise<Response> {