1import ValTown from "https://esm.sh/@valtown/sdk@0.22.0";
2import { fetchValInfo } from "https://esm.town/v/pomdtr/fetchValInfo?v=2";
3
4export async function selfDestruct(importMetaUrl: string) {
5 const { id } = await fetchValInfo(importMetaUrl);
6 const { vals } = new ValTown();
7
18const getSpaces = async () => {
19 const options = requestOptions({ method: "GET" });
20 const response = await fetch(`${apiHost}/user/spaces`, options);
21 const data = await response.json();
22 const spaceNames = data.map(space => space.name);
10 useEffect(() => {
11 const checkAuth = async () => {
12 const response = await fetch('/auth/check');
13 const data = await response.json();
14 setEmail(data.email);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramGetMe = async (botToken: string) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/getMe`,
6 );
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramGetMe = async (botToken: string) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/getMe`,
6 );
76 .toString("base64");
77
78 const response = await fetch(`https://api.switch-bot.com/${path}`, {
79 headers: {
80 "Authorization": token,
244});
245
246export default app.fetch;
1import ValTown from "https://esm.sh/@valtown/sdk@0.22.0";
2import { fetchValInfo } from "https://esm.town/v/pomdtr/fetchValInfo?v=2";
3
4export async function selfDestruct(importMetaUrl: string) {
5 const { id } = await fetchValInfo(importMetaUrl);
6 const { vals } = new ValTown();
7
2import ValTown from "npm:@valtown/sdk";
3
4export function fetchValInfo(importMetaURL: string) {
5 const vt = new ValTown();
6 const { author, name } = extractValInfo(importMetaURL);
2
3```ts
4import { fetchValInfo } from "https://esm.town/v/pomdtr/fetchValInfo"
5
6const val = await fetchValInfo(import.meta.url)
7
8console.log(val.id)
11## What's the difference with `extractValInfo` ?
12
13@pomdtr/extractValInfo get metadata synchronously by analysing the val import url, while @pomdtr/fetchValInfo perform an http call to the val.town REST api.
14
15Only use `fetchValInfo` if you need some metadata that are not available from `extractValInfo`.
3export default async function scrapeBookMyShow() {
4 const url = "https://in.bookmyshow.com/explore/home/mumbai"; // Example URL, you may need to adjust this
5 const response = await fetch(url, {
6 headers: {
7 "User-Agent":