dailyPoemForSammain.tsx3 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23async function getRandomPoem() {
4const response = await fetch("https://poetrydb.org/random");
5const [poem] = await response.json();
6return poem;
16const message = `Daily Poem:\n\n${title}\nby ${author}\n\n${lines}`;
17
18const response = await fetch('https://samwho-notify.web.val.run', {
19method: 'POST',
20headers: {
urlMetadatamain.tsx1 match
6return metadata;
7} catch (err) {
8console.error('Error fetching metadata:', err);
9return null;
10}
99100export default async function handler(req: Request): Promise<Response> {
101return await app.fetch(req);
102}
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
317}
1819const resp = await fetch("https://api.pushover.net/1/messages.json", {
20headers: {
21"Content-Type": "application/json",
isMyWebsiteDownmain.tsx2 matches
9let reason: string;
10try {
11const res = await fetch(URL, { redirect: "follow" });
12if (res.status !== 200) {
13reason = `(status code: ${res.status})`;
15}
16} catch (e) {
17reason = `couldn't fetch: ${e}`;
18ok = false;
19}
randomCardImagemain.tsx4 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export default async function(req: Request): Promise<Response> {
4try {
5const response = await fetch(
6"https://deckofcardsapi.com/api/deck/new/draw/?count=1",
7);
14}
15} catch (error) {
16console.log("Error fetching random card image:", error);
17return Response.json({
18error: `An error occurred while fetching the random card image. ${error}`,
19}, { status: 400 });
20}
1/** @jsxImportSource npm:hono@3/jsx */
2import { fetch as proxyFetch } from "https://esm.town/v/std/fetch";
3import { Hono } from "npm:hono";
4const Fetch = fetch;
56interface ShowBox {
35const { id } = c.req.param();
36const post_data = `fid=${id.split(".")[1]}&share_key=${id.split(".")[0]}`;
37const streamApiRequest = await fetch(`https://www.febbox.com/file/player?${post_data}`, {
38method: "POST",
39headers: headers,
69const _tv = (type === "S") ? `.${season}.1` : "";
70console.log(_tv);
71const idApiRequest = await fetch(`https://api.dmdb.network/v1/gmid/${type}.${tmdb}${_tv}`);
72const idApiJson = await idApiRequest.json();
73console.log(idApiJson);
78const mode = type === "M" ? 1 : 2;
79const sheguId = idApiJson["ids"]["superstream"];
80const showbox = await fetch(`https://www.showbox.media/index/share_link?id=${sheguId}&type=${mode}`, {
81headers: headers,
82});
85const febboxUrl = `https://www.febbox.com/share/${febboxId}`;
86console.log(febboxId);
87const febboxItemRequest = await fetch(`https://www.febbox.com/file/file_share_list?share_key=${febboxId}`, {
88headers: headers,
89});
122if (season === Number(season_number)) {
123const febboxSeasonId = item.fid;
124const lastPage = await fetch(
125`https://www.febbox.com/file/file_share_list?page=1&share_key=${febboxId}&pwd=&parent_id=${febboxSeasonId}`,
126{
137}
138const totalPages = Math.ceil(latestEpisode / 30) + 1;
139// _temp = await fetch(`https://www.febbox.com/file/file_share_list?page=${totalSections}&share_key=${febboxId}&pwd=&parent_id=${febboxSeasonId}`);
140// let _tempr = await _temp.json()
141// const late = _tempr.data.file_list.length;
154console.log(predictedPages);
155for (const page of predictedPages) {
156episodedReq = await fetch(
157`https://www.febbox.com/file/file_share_list?page=${page}&share_key=${febboxId}&pwd=&parent_id=${febboxSeasonId}`,
158{
183}
184}
185export default app.fetch;
duckdbExamplemain.tsx2 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export let duckdbExample = (async () => {
4async function createWorker(url: string) {
5const workerScript = await fetch(url);
6const workerURL = URL.createObjectURL(await workerScript.blob());
7return new Worker(workerURL, { type: "module" });
duckdbExampleREADME.md1 match
1# DuckDB
23[DuckDB](https://duckdb.org/) works on Val Town, with only one small tweak! We're basically using DuckDB in the same way you'd use it with a browser - using the WASM package with its dependencies fetched from [jsdelivr](https://www.jsdelivr.com/).
45The only trick is to create the worker ourselves rather than using `duckdb.createWorker`. DuckDB's built-in createWorker method doesn't specify a worker type, which causes `type` to default to `classic`, and Deno (our runtime) doesn't support classic workers.
1import { discordSendDM } from "https://esm.town/v/vtdocs/discordSendDM";
2import process from "node:process";
3import { discordFetch } from "https://esm.town/v/vtdocs/discordFetch";
4import { discordDMs } from "https://esm.town/v/vtdocs/discordDMs";
510const repliesToBot = [];
11for (const channelId of discordDMs) {
12const messages = await discordFetch(
13process.env.discordBot,
14// Note: not using pagination here