65 const { startDate, endDate } = getYesterdayDateRange();
66
67 const response = await fetch("https://api.linear.app/graphql", {
68 method: "POST",
69 headers: {
80
81 if (data.errors) {
82 console.error("Error fetching data from Linear API:", data.errors);
83 Deno.exit(1);
84 }
86 const issues = data.data.viewer.assignedIssues.nodes;
87
88 // Group issues by team and fetch issue history
89 const issuesByTeam: { [teamName: string]: any[] } = {};
90 for (const issue of issues) {
94 }
95
96 const historyResponse = await fetch("https://api.linear.app/graphql", {
97 method: "POST",
98 headers: {
110 if (historyData.errors) {
111 console.error(
112 `Error fetching history for issue ${issue.id}:`,
113 historyData.errors,
114 );
190 }
191
192 const slackResponse = await fetch("https://slack.com/api/chat.postMessage", {
193 method: "POST",
194 headers: {
94});
95
96export const webFetchTool = tool({
97 description: "Use this tool to fetch the content of a website. Returns the content as plain text.",
98 parameters: z.object({
99 url: z.string().describe("Url to download"),
136 }),
137 execute: async ({ city }) => {
138 const result = await fetch(`https://wttr.in/${city}?format=j1`);
139 return result.json();
140 },
26};
27
28const response = await fetch("https://<your-val-id>.web.val.run/", {
29 method: "POST",
30 headers: {
78 // Return error as HTML
79 return new Response(
80 generateHtmlPage(objective, null, `Failed to fetch results: ${error.message}`),
81 {
82 headers: {
10 thinkingTool,
11 tradeStocksTool,
12 webFetchTool,
13 webSearchTool,
14} from "./tools.tsx";
27 calculatorTool,
28 webSearchTool,
29 webFetchTool,
30 tradeStocksTool,
31 getWeatherTool,
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' },