From e21ea23493029521208f695b80f5225edba06845 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 11 Sep 2024 05:16:53 +0200 Subject: [PATCH] Added limit parameter set to Infinity to reddit user submissions API call, as default limit appears to be too low and posts go missing. Notifying when item gets extracted from album. --- README.md | 2 +- app.js | 3 ++- methods/imgurAlbum.js | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7d5b9ba..f83ca31 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ reddit-post-dump requires a arbitrarily recent version of Node.js. Before use, d ### Optional parameters * `--users={user1,user2}`: You may fetch posts from multiple users by either supplying a comma-separated list of usernames (no spaces) with `--users`, or by using multiple individual `--user` arguments * `--limit={number}`: Maximum amount posts per user to fetch content from -* `--sort={method}`: How posts should be sorted while fetched. This affects the `$postIndex` variable, and in combination with a `--limit` decides what posts will be included +* `--sort={method}`: How posts should be sorted while fetched. This affects the `$postIndex` variable, and in combination with a `--limit` decides what posts will be included. ### Examples * `node app.js --user=ThePendulum` diff --git a/app.js b/app.js index bf9b755..eb5edd1 100644 --- a/app.js +++ b/app.js @@ -35,7 +35,8 @@ users.forEach(username => { return saveProfileDetails(user); }).then(user => { return reddit.getUser(username).getSubmissions({ - sort: yargs.sort || config.fetch.sort + sort: yargs.sort || config.fetch.sort, + limit: Infinity }).then(submissions => ({ user, submissions diff --git a/methods/imgurAlbum.js b/methods/imgurAlbum.js index 5efa71e..115cce0 100644 --- a/methods/imgurAlbum.js +++ b/methods/imgurAlbum.js @@ -12,6 +12,10 @@ function imgurAlbum(post) { }).then(res => res.json()).then(res => { const extract = config.library.album.extractSingleItem && res.data.images.length === 1; + if(extract) { + console.log('\x1b[36m%s\x1b[0m', `Extracting single item from album '${post.title}' - ${res.data.link}`); + } + return { album: extract ? null : { id: res.data.id,