1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export const myIP = () =>
4 fetchJSON("https://api.ipify.org?format=json");
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const fetchText = async (url: string): Promise<string | null> => {
4 try {
5 const response = await fetch(url);
6 if (!response.ok) {
7 throw new Error(`HTTP error! Status: ${response.status}`);
10 }
11 catch (error) {
12 console.error("Failed to fetch feeds:", error);
13 return null;
14 }
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function keriatShemaReminser() {
5 const city = "IL-Jerusalem";
6 const { times } = await (
7 await fetch(
8 `https://www.hebcal.com/zmanim?cfg=json&city=${city}&date=${today}`
9 )
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// GitHub events
4export let githubEvents = fetch("https://lookup.icxk.top");
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const getStatusCode = async (url: string, options?: any) => {
4 let f = await fetch(url, { redirect: "follow", ...(options || {}) });
5 return f.text;
6};
22 document.getElementById("message-input").value = '';
23 const ul = document.getElementById("inbox");
24 const data = await fetch("https://api.val.town/v1/eval/@darrinm.sendChatMessage('" + message + "','"+ sender + "')")
25 .then(res => res.json())
26 .then(res => res.data)
1import { fetchHtmlDom } from "https://esm.town/v/aeaton/fetchHtmlDom";
2
3export async function kpunkShows() {
4 const url = "https://kpunk.libsyn.com/";
5 const dom = await fetchHtmlDom(url);
6 const items = dom.querySelectorAll(".leftnav a[href^='/webpage']");
7 const regex = /^\/webpage\/\d{4}\/\d{2}$/;
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const searchClosestWiki = async (searchQuery) => {
14 searchQuery
15 )}&srwhat=text&format=json&utf8=1&origin=*`;
16 const searchResponse = await fetch(searchUrl);
17 const searchData = await searchResponse.json();
18 if (!searchData.query.search.length) {
23 pageTitle
24 )}&format=json&utf8=1&origin=*`;
25 const contentResponse = await fetch(contentUrl);
26 const contentData = await contentResponse.json();
27 const pageId = Object.keys(contentData.query.pages)[0];
32 return `${extractedText.trim()}`;
33 } catch (error) {
34 console.log("Error fetching Wikipedia content:", error);
35 return `An error occurred while fetching the Wikipedia content. ${error}`;
36 }
37};
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function githubStars(username) {
4 let res = await fetch(`https://api.github.com/users/${username}/starred`);
5 return await res.json();
6}
1import { discordFetch } from "https://esm.town/v/vtdocs/discordFetch";
2
3export const discordSendDM = async (
8 // First, we need a reference to a DM (we create, or get an existing DM)
9 // https://discord.com/developers/docs/resources/user#create-dm
10 const DM = await discordFetch(
11 botToken,
12 "/users/@me/channels",
17 );
18 // Then, we send a message via the DM
19 await discordFetch(
20 botToken,
21 `/channels/${DM.id}/messages`,