1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { hnEmail } from "https://esm.town/v/rodrigotello/hnEmail";
import { email } from "https://esm.town/v/std/email?v=9";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts?v=18";
export default async function({ lastRunAt }) {
let posts = await hnLatestPosts({
query: "AI, LLM",
// lastSyncTime: lastRunAt,
search_by_date: true,
});
// for each post get the number of upvotes from the hackernews api using fetch
for (let post of posts) {
let res = await fetch(`https://hacker-news.firebaseio.com/v0/item/${post.objectID}.json`);
post.upvotes = await res.json();
}
let { html, subject } = await hnEmail({ posts });
console.log(posts);
if (posts.length)
await email({ html, subject });
}
// Forked from @stevekrouse.hnFollowApp
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 20, 2024