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
5It does do as much as other transpilers (such as esm.sh, such as rewriting `npm:` imports, etc). We may add that capability in the future. For now, if you want your npm imports to run in the browser, use `https://esm.sh/package` instead of `npm:package`.
67The below script demonstrates this transiplation behavior by fetching its own source code (`import.meta.url`) with the user agent of a browser. You can uncoment the line setting the browser agent if you want to see the difference in the output. Or you could just load this val's module URL in your browser to see the untranspiled TS.
esmTownTranspileDemomain.tsx2 matches
1/** @jsxImportSource https://esm.sh/react */
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
34const browserUserAgent: string =
89console.log(
10await fetchText(import.meta.url, {
11headers: {
12"User-Agent": browserUserAgent, // comment this line out to see untransiled code
1import { fetch as proxyFetch } from "https://esm.town/v/std/fetch";
2const Fetch = fetch;
34interface ShowBox {
12}
13export default async function(req: Request): Promise<Response> {
14const showbox = await Fetch("https://www.showbox.media/index/share_link?id=55137&type=1", {
15headers: {
16"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0",
24const febboxUrl = `https://www.febbox.com/share/${febboxId}`;
25console.log(febboxId);
26const febboxItemRequest = await fetch(`https://www.febbox.com/file/file_share_list?share_key=${febboxId}`, {
27headers: {
28"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0",
discordBotmain.tsx2 matches
1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature?v=8";
2import { fetch } from "https://esm.town/v/std/fetch";
34export type Snowflake = string;
95(async () => {
96const data = await response;
97const update = await fetch(
98`https://discord.com/api/v10/webhooks/${body.application_id}/${body.token}/messages/@original`,
99{