25
26const REQUEST_TIMEOUT_MS = 30_000;
27const FETCH_SENTINEL_TIMEOUT_MS = 20_000;
28const TELEGRAM_INTER_MESSAGE_DELAY_MS = 3000;
29const TELEGRAM_REPOST_DELAY_MS = 1000;
203const announcedEventsSentinel = new Set<string>();
204async function populateEventSentinelsFromChannel(): Promise<void> {
205 log(`Fetching event sentinel messages from Telegram channel: ${PRIMARY_CHAT_ID}`);
206 const sentinelUrl = `https://t.me/s/${PRIMARY_CHAT_ID.replace(/^@/, "")}`;
207 try {
208 const { data: html } = await httpClient.get(sentinelUrl, { timeout: FETCH_SENTINEL_TIMEOUT_MS });
209 const $ = cheerio.load(html);
210 $(".tgme_widget_message_text").slice(-75).each((_i, el) => {
251 log(`Populated ${announcedEventsSentinel.size} event sentinels from channel history.`);
252 } catch (error) {
253 errorLog("Failed to fetch/parse event sentinel messages:", error.message);
254 }
255}
520 errorLog(`Exception in scrapeSeriesPageForDetails for ${seriesPageUrl}:`, e.message);
521 return {
522 definitiveSeriesTitle: "Error fetching title",
523 definitiveSeriesImage: "",
524 synopsis: "Error fetching synopsis.",
525 };
526 }
563 if (
564 !details.definitiveSeriesTitle || details.definitiveSeriesTitle === "Unknown Title"
565 || details.definitiveSeriesTitle === "Error fetching title"
566 ) {
567 errorLog(
18});
19
20export default app.fetch;
3
4const checkSingleProduct = async (url: string, shopName: string, addToCartHtml: string) => {
5 const res = await fetch(url);
6 const html = await res.text();
7
1import { fetch } from "https://esm.town/v/std/fetch";
2import { parseXML } from "https://esm.town/v/stevekrouse/parseXML";
3let { parse } = await import("npm:node-html-parser");
13 console.log("Old Items", oldItems);
14
15 // Fetch each source, filter unseen news items
16 for (const source of sources) {
17 const sourceItems = await fetchSource(source, oldItems, descMaxLength);
18 newItems = { ...newItems, ...sourceItems };
19 }
28}
29
30async function fetchSource(url: string, oldItems: any, descMaxLength: number) {
31 // Fetch a source, filter unseen news items
32 console.log(`fetch: ${url}`);
33
34 function parseDescription(description: string, maxlength: number) {
55 const hostname = new URL(url).hostname || "";
56 const oldLinks = new Set(Object.keys(oldItems));
57 const response = await fetch(url, { signal: AbortSignal.timeout(5000) });
58 const responseJSON = await parseXML(await response.text());
59 const items = responseJSON.rss.channel.item.filter(
85 async load(force) {
86 try {
87 const res = await fetch('?api=1');
88 const data = await res.json();
89 // Only overwrite local if we have no unsaved edits, or we're forcing (first load)
111 this.status = 'Saving...';
112 try {
113 const res = await fetch('', {
114 method: 'POST',
115 headers: { 'Content-Type': 'application/json' },
31function getAuthorizedPoints() {
32 console.log("Début getAuthorizedPoints - authorizedVehicles:", authorizedVehicles);
33 fetch("https://xnyx-ex15-ndvx.n7.xano.io/api:_aqWQ_f_/cached_mapCompanies", {
34 method: "POST",
35 headers: {
76 const fontPromises = fontsConfig.map(async (font) => {
77 const fontUrl = 'https://cdn.jsdelivr.net/npm/@tamagui/font-inter@1.108.3/otf/' + font.fontFile
78 const fontArrayBuf = await fetch(fontUrl).then((res) => res.arrayBuffer())
79 return { name: font.name, data: fontArrayBuf, weight: font.weight }
80 })
87 // const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
88 const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`
89 return fetch(api).then((r) => r.text())
90}
91
7 console.log("click: ", JSON.stringify(clickData));
8
9 fetch("/api/action", {
10 method: "POST",
11 headers: {
17 let html = await readFile("/frontend/index.html", import.meta.url);
18
19 const response = await fetch(`/api/demo/${id}`);
20 const initialData = await response.json();
21
87// Client-side event recording
88window.recordClick = function (action) {
89 fetch(`/api/setAction`, {
90 method: "POST",
91 headers: { "Content-Type": "application/json" },
7 const pinger = setInterval(async () => {
8 // check the boolean to see if a Glancer has enabled the link to start a cobrowsing session
9 const resp = await fetch("/api/cobrowse/" + window.__DEMO_ID__, {
10 method: "GET",
11 headers: {