Connected to reddit.

This commit is contained in:
ThePendulum 2018-04-10 00:26:30 +02:00
parent 99f421fb36
commit a0125fae11
3 changed files with 42 additions and 1 deletions

23
app.js
View File

@ -1 +1,22 @@
console.log('Reddit post dump');
'use strict';
const config = require('config');
const yargs = require('yargs').argv;
const snoowrap = require('snoowrap');
console.log(yargs.user);
const reddit = new snoowrap(config.api);
reddit.getUser(yargs.user).getSubmissions({
sort: 'top'
}).then(submissions => {
const details = submissions.map(submission => {
return {
title: submission.title,
url: submission.url
};
});
console.log(details);
});

19
package-lock.json generated
View File

@ -125,6 +125,15 @@
"delayed-stream": "1.0.0"
}
},
"config": {
"version": "1.30.0",
"resolved": "https://registry.npmjs.org/config/-/config-1.30.0.tgz",
"integrity": "sha1-HWCp81NIoTwXV5jThOgaWhbDum4=",
"requires": {
"json5": "0.4.0",
"os-homedir": "1.0.2"
}
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -433,6 +442,11 @@
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
},
"json5": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json5/-/json5-0.4.0.tgz",
"integrity": "sha1-BUNS5MTIDIbAkjh31EneF2pzLI0="
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
@ -574,6 +588,11 @@
"resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz",
"integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8="
},
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
},
"os-locale": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz",

View File

@ -22,6 +22,7 @@
"author": "Niels Simenon",
"license": "ISC",
"dependencies": {
"config": "^1.30.0",
"fs-extra": "^5.0.0",
"note-log": "^2.1.11",
"snoowrap": "^1.15.2",