Cleaned up entrypoint.
This commit is contained in:
19
src/archives/getArchivePostIds.js
Normal file
19
src/archives/getArchivePostIds.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
const config = require('config');
|
||||
|
||||
const archives = require('./archives.js');
|
||||
|
||||
function getArchivePostIds(username, exclude) {
|
||||
console.log('Searching archives for posts...');
|
||||
|
||||
return Promise.all(config.fetch.archives.reddit.map(source => archives[source](username))).then(postIds => postIds.flatten()).then(postIds => {
|
||||
return exclude ? postIds.filter(postId => !exclude.includes(postId)) : postIds;
|
||||
}).then(postIds => {
|
||||
console.log(`Found ${postIds.length} unique archived posts`);
|
||||
|
||||
return postIds;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = getArchivePostIds;
|
||||
Reference in New Issue
Block a user