21movieMashupsViewRoute(app);
22movieNewMashupMashupRoute(app);
23export default app.fetch;
1import { fetch } from "https://esm.town/v/std/fetch";
2
3type Market = {
6};
7export async function searchManifoldMarkets(query: string) {
8 const result = await fetch(
9 `https://manifold.markets/api/v0/search-markets?${query}`,
10 );
29 getSourcesParams.append("b", browserid);
30 console.log(getSourcesParams);
31 const result = await fetch(
32 `https://rabbitstream.net/ajax/v2/embed-4/getSources?${getSourcesParams.toString()}`,
33 {
49});
50
51export default app.fetch;
39}
40export async function getMeta(id) {
41 const req = await fetch(`https://rabbitstream.net/v2/embed-4/${id}?z=`, {
42 headers: {
43 "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0",
55}
56export async function getWasm() {
57 const req = await fetch("https://rabbitstream.net/images/loading.png?v=0.6", {
58 "headers": {
59 "Referrer-Policy": "strict-origin-when-cross-origin",
1// This approach will fetch weather data from a Wunderground API, parse the JSON response,
2// and display a simplified version of the current conditions in separate tiles. We'll use
3// the fetch API to make the HTTP request and React for rendering the UI.
4
5/** @jsxImportSource https://esm.sh/react */
27
28 useEffect(() => {
29 const fetchWeather = () => {
30 setLastChecked(new Date());
31 fetch("/api/weather" + window.location.search)
32 .then(response => response.json())
33 .then(data => {
41 };
42
43 fetchWeather(); // Fetch immediately on load
44
45 const intervalId = setInterval(() => {
46 if (consecutiveErrors < 5) {
47 fetchWeather();
48 } else {
49 setError("Too many errors occurred. Updates paused. Please refresh the page to try again.");
183 if (url.pathname === "/api/weather") {
184 try {
185 const wundergroundResponse = await fetch(
186 `https://api.weather.com/v2/pws/observations/current?stationId=${stationId}&format=json&units=e&apiKey=e1f10a1e78da46f5b10a1e78da96f525`,
187 );
212 });
213 } catch (error) {
214 return new Response(JSON.stringify({ error: "Failed to fetch weather data" }), {
215 status: 400,
216 headers: { "Content-Type": "application/json" },
22
23 try {
24 const response = await fetch("/generate", {
25 method: "POST",
26 headers: {
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
8 const stories = await Promise.all(
9 storyIds.slice(0, count).map(async (id: number) => {
10 const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11 return storyResponse.json();
12 }),
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);
123 const newStories = await fetchStories("new", 5);
124 const showStories = await fetchStories("show", 3);
125 const askStories = await fetchStories("ask", 3);
126 const jobStories = await fetchStories("job", 3);
127
128 const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function proxy(req: Request) {
4 const resp = await fetch(
5 "http://api.quotable.io/quotes/random?limit=1",
6 );
16async function POST(cmd: string, data: { [key: string]: string }) {
17 const url = BOT + "/" + cmd;
18 return await (await fetch(
19 url,
20 {
27
28async function GET(cmd: string) {
29 return await (await fetch(BOT + "/" + cmd)).json();
30}
31