Skip to content

Commit

Permalink
add default to scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
squidgetx committed Jan 10, 2023
1 parent f3fa7d7 commit 4d0d305
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/db/scraper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ async function fetchTweetsForElites() {
const elites = await fetchElites();
for (let e of elites) {
console.log("fetching for ", e);
fetch_and_write_for_id(e.id, e.date.toISOString());
// If no tweets found in DB default to starting from last week
const date = e.date || new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
fetch_and_write_for_id(e.id, date.toISOString());
}
}

Expand Down

0 comments on commit 4d0d305

Please sign in to comment.