Runs every 1 hrs
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail?v=20";
import { hackerNewsAuthors } from "https://esm.town/v/brandon/hackerNewsAuthors";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts?v=18";
export async function hnFollowPollJob({ lastRunAt }) {
let posts = await hnLatestPosts({
authors: hackerNewsAuthors,
lastSyncTime: lastRunAt,
search_by_date: true,
});
// filter posts by title
posts = posts.filter((post) => post.title.includes("Generative Voice"));
// sort posts by score
posts.sort((a, b) => b.score - a.score);
// get top 20 posts
posts = posts.slice(0, 20);
let { text, subject } = await hnEmail({ posts });
if (posts.length) console.email(text, subject);
}