Added watch-mode. Waiting for profile detail write to finalize before new watch cycle and capture details in index file.

This commit is contained in:
2024-09-11 05:16:56 +02:00
parent dcf7fdd274
commit fcb85f57c8
9 changed files with 99 additions and 31 deletions

View File

@@ -16,7 +16,7 @@ async function getIndexedPosts(user) {
} catch (error) {
console.log('\x1b[33m%s\x1b[0m', `Could not load index file for '${user.name}' at '${indexFilePath}': ${error}`);
return [];
return { profile: { image: null, description: null }, posts: [] };
}
}

View File

@@ -54,7 +54,7 @@ function getUserPostsWrap(reddit, args) {
getPosts(username, reddit, args),
]);
const indexed = await getIndexedPosts(user);
const { posts: indexed } = await getIndexedPosts(user);
if (args.archives) {
posts.push(...await getArchivedPosts(username, posts, reddit));