1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { email } from "https://esm.town/v/std/email?v=9";
import { hnEmail } from "https://esm.town/v/akkartik/hnEmail";
import { hnFollowLastSyncTime } from "https://esm.town/v/akkartik/hnFollowLastSyncTime";
import { hnAuthors } from "https://esm.town/v/akkartik/hnAuthors";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts?v=18";
export const hnFollow = async () => {
// poll using @stevekrouse's helper function
let posts = await hnLatestPosts({
authors: hnAuthors,
lastSyncTime: hnFollowLastSyncTime,
search_by_date: true,
});
// if there are results, email yourself
if (!posts?.length) {
return;
}
let { text, subject } = await hnEmail({ posts });
await email({ html: text, subject });
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { email } from "https://esm.town/v/std/email?v=9";
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail?v=20";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts?v=18";
export async function hnFollowShowHNPosts() {
let posts = await hnLatestPosts({
tags: "show_hn",
search_by_date: true,
});
let { text, subject } = await hnEmail({ posts });
if (posts.length)
await email({ text, subject });
return text;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail?v=20";
import { hackerNewsAuthors } from "https://esm.town/v/ritz/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,
});
let { text, subject } = await hnEmail({ posts });
if (posts.length) console.email(text, subject);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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: "maggieappleton",
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { html, subject } = await hnEmail({ posts });
console.log(posts);
if (posts.length)
await email({ html, subject });
}
// Forked from @stevekrouse.hnFollowApp
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);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail?v=20";
import { hackerNewsAuthors } from "https://esm.town/v/stiha/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,
});
let { text, subject } = await hnEmail({ posts });
if (posts.length) console.email(text, subject);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { email } from "https://esm.town/v/std/email?v=9";
import { hnEmail } from "https://esm.town/v/rodrigotello/hnEmail";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts?v=18";
export const hnFollowApp = function (authors: string[]) {
return async function ({ lastRunAt }) {
let posts = await hnLatestPosts({
authors,
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { html, subject } = await hnEmail({ posts });
if (posts.length)
await email({ html, subject });
};
};
// Forked from @stevekrouse.hnFollowApp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { email } from "https://esm.town/v/std/email?v=9";
import { hnEmail } from "https://esm.town/v/rodrigotello/hnEmail?v=14";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts";
export const hnFollowApp = function (authors: string[], tags = ["story", "comment"]) {
return async function ({ lastRunAt }) {
let posts = await hnLatestPosts({
authors,
lastSyncTime: lastRunAt,
search_by_date: true,
tags: tags.join(","),
});
let { html, subject } = await hnEmail({ posts });
if (posts.length)
return email({ html, subject });
};
};
// Forked from @rodrigotello.hnFollowApp
Runs every 15 min
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import process from "node:process";
import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts";
export async function hnValTown({ lastRunAt }: Interval) {
let posts = await hnLatestPosts({
query: '"val town" || "val.town"',
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { text } = await hnEmail({ posts, footer: false });
if (posts.length) {
await discordWebhook({
url: process.env.mentionsDiscord,
content: text,
});
}
}
Runs every 15 min
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { email } from "https://esm.town/v/std/email?v=9";
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts";
export async function hnFollowPollJobError({ lastRunAt }: Interval) {
try {
let posts = await hnLatestPosts({
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { text, subject } = await hnEmail({ posts });
console.log(posts);
console.log(!posts.length);
if (!posts.length)
await email({ subject: "HN Follow may be bugging" });
}
catch (e) {
console.log("error");
await email({ subject: "HN Follow may be bugging" });
throw e;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail";
import { hackerNewsAuthors } from "https://esm.town/v/stevekrouse/hackerNewsAuthors";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts";
export async function hnFollowPollJob({ lastRunAt }) {
let posts = await hnLatestPosts({
authors: hackerNewsAuthors,
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { text, subject } = await hnEmail({ posts });
if (posts.length) console.email(text, subject);
}
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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 const hnFollowApp = function(authors: string[]) {
return async function({ lastRunAt }) {
let posts = await hnLatestPosts({
authors,
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { html, subject } = await hnEmail({ posts });
if (posts.length)
await email({ html, subject });
};
};
// Forked from @stevekrouse.hnFollowApp
1
2
3
4
5
6
7
8
9
10
11
12
13
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail?v=20";
import { hackerNewsAuthors } from "https://esm.town/v/timwee/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,
});
let { text, subject } = await hnEmail({ posts });
if (posts.length) console.email(text, subject);
}
Runs every 7 days
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { email } from "https://esm.town/v/std/email?v=9";
import { hnEmail } from "https://esm.town/v/stevekrouse/hnEmail?v=20";
import { hnLatestPosts } from "https://esm.town/v/stevekrouse/hnLatestPosts?v=18";
export async function hnClojure({ lastRunAt }: Interval) {
let posts = await hnLatestPosts({
query: "clojure",
lastSyncTime: lastRunAt,
search_by_date: true,
});
let { text, subject } = await hnEmail({ posts });
if (posts.length)
await email({ text, subject });
}