Skip to content

Commit b70eb7e

Browse files
richteagueclaude
andcommitted
Filter arXiv results to today's papers only
Instead of processing the latest N papers regardless of date, now filters to only papers whose published date matches today (UTC). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 066019b commit b70eb7e

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

disk-digest.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,23 @@ async function fetchArxivPapers() {
1616
const res = await fetch(url);
1717
const xml = await res.text();
1818

19+
const today = new Date().toISOString().slice(0, 10); // YYYY-MM-DD UTC
20+
1921
const entries = [...xml.matchAll(/<entry>([\s\S]*?)<\/entry>/g)];
20-
return entries.map(([, entry]) => {
21-
const get = tag => entry.match(new RegExp(`<${tag}[^>]*>([\\s\\S]*?)<\/${tag}>`))?.[1]?.replace(/\s+/g, " ").trim() ?? "";
22-
const authors = [...entry.matchAll(/<name>([\s\S]*?)<\/name>/g)].map(m => m[1].trim());
23-
return {
24-
id: get("id"),
25-
title: get("title"),
26-
abstract: get("summary"),
27-
link: get("id"),
28-
authors,
29-
};
30-
});
22+
return entries
23+
.map(([, entry]) => {
24+
const get = tag => entry.match(new RegExp(`<${tag}[^>]*>([\\s\\S]*?)<\/${tag}>`))?.[1]?.replace(/\s+/g, " ").trim() ?? "";
25+
const authors = [...entry.matchAll(/<name>([\s\S]*?)<\/name>/g)].map(m => m[1].trim());
26+
return {
27+
id: get("id"),
28+
title: get("title"),
29+
abstract: get("summary"),
30+
link: get("id"),
31+
published: get("published").slice(0, 10),
32+
authors,
33+
};
34+
})
35+
.filter(p => p.published === today);
3136
}
3237

3338
// Claude relevance check for all fetched papers
@@ -146,7 +151,7 @@ async function main() {
146151

147152
console.log("📡 Fetching arXiv papers...");
148153
const all = await fetchArxivPapers();
149-
console.log(` ${all.length} total papers fetched.`);
154+
console.log(` ${all.length} papers published today.`);
150155

151156
console.log("🔍 Running Claude relevance check...");
152157
const matched = [];

0 commit comments

Comments
 (0)