2018-04-09 22:26:30 +00:00
|
|
|
'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);
|
|
|
|
});
|